Top menu

Coding Standards for Drupal, Symfony and Twig

Twig : http://twig.sensiolabs.org/doc/coding_standards.html Symfony : http://symfony.com/doc/current/contributing/code/standards.html Drupal : https://drupal.org/coding-standards Configuring drupal with netbeans : https://drupal.org/node/1019816

0

How to truncate String by Words

If you simply want to truncate text to a certain number of words, because you do not want a word will be cut, the code below will do the trick:

 

0

Add param in URL

In the function below, I will show you how to add a parameter in URL by treating all possible cases : first check whether the parameter is already defined in the URL so that we can just update it if parameter is already defined in the URL, so replace the parameter value, rather than append […]

0

How to insert a block into a node or template in Drupal 7

   

$block = module_invoke(‘simplenews’, ‘block_view’, ’24’);

0

How do I redirect a form after has been submitted

   

OR :

       

0

Add attribute to field form

 

 

0

How to use the “getDefaultOptions” to initialize a form field value

In this article I will show you how to create a form by setting a field on a passed value from controller using the getDefaultOptions function :

Now in the controller we can create the form with a default value for the option “userType” that allow us to define the value of the  : […]

0

How to add no mapped field in form

If you wish the field to be ignored when reading or writing to the object, you can set the property_path option to false.

NB : Since 2.1, the mapped option has been added for this use-case.

0