Skip to content

Instantly share code, notes, and snippets.

@justinmarsan
Forked from tsavory/all fixed I guess
Created June 11, 2012 08:32
Show Gist options
  • Save justinmarsan/2909091 to your computer and use it in GitHub Desktop.
Save justinmarsan/2909091 to your computer and use it in GitHub Desktop.
first attempt
<?php
/**
* Intergrates Flex Book web pages
*
*/
function flex_book_node_view($node) {
if($node->type == 'flex_book'){
$load_js = $node->field_load_js;//calls the field and makes it load.js
foreach($load_js['und'] as $js_file) { // gets the und from laod.js
drupal_add_js(base_path().$js_file['value']);// loads the JS to the page
}
$load_css = $node->field_load_css;//calls the field and makes it load.css
foreach($load_css['und'] as $css_file) { // gets the und from laod.css
drupal_add_css(base_path().$css_file['value']);// loads the CSS to the page
}
}
}
<?php
/**
* Intergrates Flex Book web pages
*
*/
function flex_book_node_view($node, $view_mode ) {
if($node->type == 'flex_book'){
$load_js = $node->field_load_js;
var_dump($load_js);
}
}
<?php
/**
* Intergrates Flex Book web pages
*
*/
function flex_book_node_view($node, $view_mode ) {
if($node->type == 'flex_book'){
$load_js = $node->field_load_js;
foreach($load_js['und'] as $js_file) { var_dump($js_file); }
}
}
<?php
/**
* Intergrates Flex Book web pages
*
*/
function flex_book_node_view($node) {
if($node->type == 'flex_book'){
$load_js = $node->field_load_js;//calls the field and makes it load.js
foreach($load_js['und'] as $js_file) // gets the und from laod.js
{ drupal_add_js($js_file['value']); }// loads the JS to the page
$load_css = $node->field_load_css;//calls the field and makes it load.css
foreach($load_css['und'] as $css_file) // gets the und from laod.css
{ drupal_add_css($css_file['value']); }// loads the CSS to the page
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment