Posts

Showing posts from April, 2016

JS ordering in Drupal

Adding .js in info files adds that js file to every page of the website. Scripts added in a theme's .info file are added at the theme level of ordering and will come after core/library JavaScript and module JavaScript. Ordring: core modules => contributed modules => theme  Altering the scope of the JS file function YOURTHEME_js_alter(&$javascript) { $header_scripts = array( 'sites/all/libraries/modernizr/modernizr.min.js', 'misc/drupal.js', 'sites/all/modules/jquery_update/replace/jquery/1.5/jquery.min.js', ); foreach ($javascript as $key => &$script) { if ($script['scope'] == 'header' && !in_array($script['data'], $header_scripts)) { $script['scope'] = 'footer'; } } }

Running simpletest from command line

php scripts/run-tests.sh --php /Applications/MAMP/bin/php/php5.6.10/bin/php --list => lists all test cases php ./scripts/run-tests.sh --php /Applications/MAMP/bin/php/php5.3.29/bin/php --all => runs all test cases php ./scripts/run-tests.sh --php /Applications/MAMP/bin/php/php5.3.29/bin/php Webform => it runs all the test cases in webform module