API page: https://api.drupal.org/api/drupal/modules%21system%21system.api.php/func...

The sentence

"To add CSS or JS that should be present on all pages..."

is inaccurate. Suggested improvement

"To add static CSS or JS that should be present on all pages..."

See also https://api.drupal.org/api/drupal/includes%21common.inc/function/drupal_...

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

augustofagioli created an issue. See original summary.

afagioli’s picture

Issue summary: View changes
amit0212’s picture

Like this, you can use css and js.

function animate_any_page_build(&$page) {
  // call every time when page loaded
  $path = drupal_get_path('module', 'animate_any');
  $fetch = db_select("animate_any", "a");
  $fetch->fields('a');
  $fetch_results = $fetch->execute()->fetchAll();
  $json_data = json_encode($fetch_results);
  drupal_add_css($path . '/css/animate.css');
  drupal_add_js($path . '/js/animate_any.js');
  drupal_add_js(array('animate_any' => array('animation_data' => $json_data)), array('type' => 'setting'));
}
tatarbj’s picture

Status: Active » Needs review
FileSize
603 bytes

I totally agree with the proposal, here is the patch that fixes this documentation mistake.

mahalingam_cs’s picture

Status: Needs review » Reviewed & tested by the community
FileSize
56.17 KB

Applied patch from #4 successfully. The sentence is updated successfully. Attached screenshot

David_Rothstein’s picture

Status: Reviewed & tested by the community » Needs review

Can you clarify what the word "static" is supposed to mean in this context?

If the idea is that it's referring to CSS and JS files (as opposed to e.g. inline CSS and JS) I think it would be preferable to say that directly, e.g. "To add CSS or JS files that should be present on all pages..."

afagioli’s picture

David,
my suggestion came out while trying to add inline CSS/JS, so your:

"To add CSS or JS files that should be present on all pages..." will work even better.

Thanks

tatarbj’s picture

Hi @David_Rotstein and @augustofagioli,
yes, i think that makes more sense then using static word that could confuse ppl.
I've created a new patch for this.
Cheers,
Balazs.

Dinesh18’s picture

Status: Needs review » Reviewed & tested by the community

patch #8 sounds good and more appropriate.
Changing the status to RTBC

afagioli’s picture

Cool. Thanks!

David_Rothstein’s picture

Title: Static JS or CSS in .info file » Improve documentation regarding static JS or CSS in .info files
Status: Reviewed & tested by the community » Fixed

Committed to 7.x - thanks!

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.