[keyword] drupal7

TIP: PHPCSMD: a plugin for PHP Code Sniffer compatible with NetBeans8 and the Drupal Coding Standards from Coder

If you are using NetBeans IDE for Drupal contributed module development - my absolutely favourite IDE for many years, and super for PHP and Drupal work - then you SHOULD take the time and trouble to install a plugin that gives you feedback on departures from Drupal coding standards, this can save you days of fiddly work.

TIP: NetBeans: removing trailing whitespace (to meet the Drupal Coding Standards and pass Coder/PHP_CodeSniffer)

This works for removing trailing whitespace in NetBeans 8.0 (Mac version):

NetBeans > Preferences > Editor > On Save > Remove Trailing Whitespace From: All Lines 

Make sure you have:

Language = PHP

And you may need to deselect:

Drupal Commerce and Rules: Challenge: prevention of the addition and/or removal of incompatible cart Product items

TODO: this content is incomplete, unfinished, or under construction.
STUB: this content is flagged as a placeholder only, with minimal content.

At the time of writing, because Drupal Commerce does not yet have an official action for preventing addition of incompatible product items to a cart, one needs to use one of a number of tricks to handle cases of incompatible products.

Drupal Commerce and Rules

A zone with some links to interesting resources for Drupal Commerce and related Rules, and some discussions of oft-encountered challenges.

Drupal7: functions and hooks related to core Trigger and actions for system events

There are some remarks on core Trigger vs Rules under the Rules module review page.


It's worth examining the docs for actions_do($action_ids, $object = NULL, $context = NULL, $a1 = NULL, $a2 = NULL):

Performs a given list of actions by executing their callback functions.

Drupal7: functions related to (programmatic) user management

Drupal7 has pretty good out-of-the-box user and user account configuration options for most basic web sites (including configurable email templates for communication with users about accounts), but as soon as work on more complex sites with specific user/business requirements you have going to have to get you hands dirty with low-level user functions and/or user-related Rules.

TIPS: Drush command line tools for Drupal

This info in this Drush zone is mostly already covered by links and remarks at the module review page Drush [command line admin and scripting], where you'll also find Drush install instructions and some more 'drush' command line usage examples.

Drupal7 AJAX commands (outside forms)

Did you know ?

If has a link has class 'use-ajax' <a class='use-ajax href="..."> Drupal will replace an explicit 'nojs' in the path with 'ajax'. But in fact if we call on a response menu item without any '/nojs' in the path to replace, and Drupal will still APPEND '/ajax' (or '/nojs' accordingly), which can then be processed as the first argument in the response callback (and tested for 'ajax' vs 'nojs') !

Drupal(7) venting, rants, and ROTFL from others

STUB: this content is flagged as a placeholder only, with minimal content.

A less than serious collection of less than serious vents and rants about Drupal (served to you right here on a Drupal7 CMS instance). You don't have to love every bit of Drupal to use it, or to be a "valid" or "good" Drupal citizen. Never forget: Dr Darren says: 'Just because I (constructively) criticise some aspects of Drupal core and the module development API does not mean I don't appreciate Drupal and what one can do with it'.

Drupal 7: functions related to security

Some key points adapted from Handle text in a secure fashion:

NB: the form elements #description and #title require you to sanitise any user-supplied substitution text using @user_supplied or %user_supplied (not !user_supplied).

NB: block descriptions (but NOT TITLES) are automatically sanitised.

template_preprocess_node(&$variables)

Processes variables for node.tpl.php

Most themes utilize their own copy of node.tpl.php. The default is located inside "modules/node/node.tpl.php". Look in there for the full list of variables.

The $variables array contains the following arguments:
- $node
- $view_mode
- $page

Drupal7 entities, bundles, and fields

Some of the information in this zone combines aspects of the core Drupal7 entity and field handling and the contributed Entity API extensions, please be aware of this distinction when reading the references.

Drupal7: on splitting module code into separate .inc include files

HOT TIP: this content is flagged as highly recommended !

Some key points about use of .inc files with Drupal7

Example of loading include file in same folder as the .module:

./includes/language.inc: *   module_load_include('language', 'inc', 'language.negotiation');
 
./includes/module.inc: *   module_load_include('inc', 'node', 'node.admin');
./includes/module.inc: *   module_load_include('inc', 'node', 'content_types');

Example of loading include file in a subfolder includes:

Drupal7: working with files (and image files)

STUB: this content is flagged as a placeholder only, with minimal content.

Drupal7 translation, localization, and the t() function

Some useful external links concerning Drupal7's strategy for registering translatable strings.

At the time of writing, that strategy is not easy to marry with OO encapsulation of strings. For the OOE = Object Oriented Examples = One Of Each module this means that it is difficult to apply translation policy switches to encapsulated strings as used in the Render classes.

Some key points to keep in mind are (as quoted 8 Aug 2014).

Drupal: general TIPS external links

A collection of links to useful external sites with general info on Drupal. Some are a bit out of date (have some Drupal6-specific content). They are all worth at least a glance.

Drupal7: essential global functions and hooks

Global functions: a good place to start is common.inc: Common functions that many Drupal modules will need to reference. 'The functions that are critical and need to be available even when serving a cached page are instead located in bootstrap.inc'.

Drupal7 Forms, the Form API (FAPI), and Forms tutorials

Once you've got a handle on the Form API, one of the best references for daily work is the Form API Reference, which tries to tabulate which form '#' properties are valid for each Form element '#type', along with some default values.

Pages

Subscribe to RSS - drupal7