本文整理汇总了PHP中drupal_add_library函数的典型用法代码示例。如果您正苦于以下问题:PHP drupal_add_library函数的具体用法?PHP drupal_add_library怎么用?PHP drupal_add_library使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了drupal_add_library函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: cignaglobal_textfield
/**
* Theme override function to output bootstrap-style textfield.
* This is a workaround for the issue that bootstrap_element_info_alter
* can be skipped due to theme not yet being initialized when drupal_alter
* call made.
*
* @ingroup themeable
* @see theme_textfield
*/
function cignaglobal_textfield($vars)
{
$element = $vars['element'];
$element['#attributes']['type'] = 'text';
element_set_attributes($element, array('id', 'name', 'value', 'size', 'maxlength'));
// Add form-control class if it does not exist.
$classes = array('form-text');
if (!isset($element['#attributes']['class']) || !in_array('form-control', $element['#attributes']['class'])) {
$classes[] = 'form-control';
}
_form_set_class($element, $classes);
$extra = '';
if ($element['#autocomplete_path'] && !empty($element['#autocomplete_input'])) {
drupal_add_library('system', 'drupal.autocomplete');
$element['#attributes']['class'][] = 'form-autocomplete';
$attributes = array();
$attributes['type'] = 'hidden';
$attributes['id'] = $element['#autocomplete_input']['#id'];
$attributes['value'] = $element['#autocomplete_input']['#url_value'];
$attributes['disabled'] = 'disabled';
$attributes['class'][] = 'autocomplete';
$extra = '<input' . drupal_attributes($attributes) . ' />';
}
$output = '<input' . drupal_attributes($element['#attributes']) . ' />';
return $output . $extra;
}
示例2: brush_form_alter
/**
* Implements template_form_alter.
*/
function brush_form_alter(&$form, &$form_state, $form_id)
{
if (strstr($form_id, 'commerce_cart_add_to_cart_form') || $form_id == 'views_form_commerce_cart_form_default') {
drupal_add_library('system', 'ui.spinner');
$form['#attached']['js'] = array(drupal_get_path('theme', 'brush') . '/js/commerce_spinner.js');
}
}
示例3: omega_sr_form_system_theme_settings_alter
function omega_sr_form_system_theme_settings_alter(&$form, &$form_state)
{
include_once 'template.php';
drupal_add_js(drupal_get_path('theme', 'omega_sr') . '/js/theme.js');
drupal_add_css(drupal_get_path('theme', 'omega_sr') . '/css/theme.css');
drupal_add_css(drupal_get_path('theme', 'omega_sr') . '/js/rs-plugin/css/font-style.css');
drupal_add_library('system', 'ui');
drupal_add_library('system', 'farbtastic');
drupal_add_library('system', 'ui.sortable');
drupal_add_library('system', 'ui.draggable');
drupal_add_library('system', 'ui.dialog');
$form_state['build_info']['files'][] = drupal_get_path('theme', 'omega_sr') . '/theme-settings.php';
$form['#validate'][] = 'omega_sr_settings_validate';
$form['#submit'][] = 'omega_sr_settings_submit';
$settings['slider'] = theme_get_setting('slider', 'omega_sr');
$form['theme_settings']['#collapsible'] = TRUE;
$form['theme_settings']['#collapsed'] = TRUE;
$form['logo']['#collapsible'] = TRUE;
$form['logo']['#collapsed'] = TRUE;
$form['favicon']['#collapsible'] = TRUE;
$form['favicon']['#collapsed'] = TRUE;
$form['alpha_settings']['slider-revolution'] = array('#type' => 'fieldset', '#title' => t('Slider revolution'));
// Breadcrumb elements
$form['alpha_settings']['slider-revolution']['slider-show'] = array('#type' => 'select', '#title' => t('Enable front page slider'), '#options' => array("1" => t('Yes'), "0" => t('No')), '#default_value' => theme_get_setting('slider-show', 'omega_sr'));
include_once drupal_get_path('theme', 'omega_sr') . '/js/rs-plugin/RevolutionSlider.slider.inc';
}
示例4: add_meta
function add_meta()
{
ctools_include('display-edit', 'panels');
ctools_include('content');
if (empty($this->display->cache_key)) {
$this->cache = panels_edit_cache_get_default($this->display);
}
// @todo we may need an else to load the cache, but I am not sure we
// actually need to load it if we already have our cache key, and doing
// so is a waste of resources.
ctools_include('cleanstring');
$this->clean_key = ctools_cleanstring($this->display->cache_key);
$button = array('#type' => 'link', '#title' => t('Customize this page'), '#href' => $this->get_url('save_form'), '#id' => 'panels-ipe-customize-page', '#attributes' => array('class' => array('panels-ipe-startedit', 'panels-ipe-pseudobutton')), '#ajax' => array('progress' => 'throbber', 'ipe_cache_key' => $this->clean_key), '#prefix' => '<div class="panels-ipe-pseudobutton-container">', '#suffix' => '</div>');
panels_ipe_toolbar_add_button($this->clean_key, 'panels-ipe-startedit', $button);
// @todo this actually should be an IPE setting instead.
if (user_access('change layouts in place editing')) {
$button = array('#type' => 'link', '#title' => t('Change layout'), '#href' => $this->get_url('change_layout'), '#attributes' => array('class' => array('panels-ipe-change-layout', 'panels-ipe-pseudobutton', 'ctools-modal-layout')), '#ajax' => array('progress' => 'throbber', 'ipe_cache_key' => $this->clean_key), '#prefix' => '<div class="panels-ipe-pseudobutton-container">', '#suffix' => '</div>');
panels_ipe_toolbar_add_button($this->clean_key, 'panels-ipe-change-layout', $button);
}
ctools_include('ajax');
ctools_include('modal');
ctools_modal_add_js();
ctools_add_css('panels_dnd', 'panels');
ctools_add_css('panels_admin', 'panels');
ctools_add_js('panels_ipe', 'panels_ipe');
ctools_add_css('panels_ipe', 'panels_ipe');
drupal_add_js(array('PanelsIPECacheKeys' => array($this->clean_key)), 'setting');
drupal_add_library('system', 'ui.draggable');
drupal_add_library('system', 'ui.droppable');
drupal_add_library('system', 'ui.sortable');
parent::add_meta();
}
示例5: analytics_portal_textfield
function analytics_portal_textfield($variables)
{
$element = $variables['element'];
$output = '';
// login form adding glyphicon.
if ($element['#name'] == 'name') {
$output = '<span class="input-group-addon"><span class="glyphicon glyphicon-user"></span></span>';
}
// force type.
$element['#attributes']['type'] = 'text';
// set placeholder.
if (isset($variables['element']['#description'])) {
$element['#attributes']['placeholder'] = $variables['element']['#description'];
}
element_set_attributes($element, array('id', 'name', 'value', 'size', 'maxlength'));
// adding bootstrap classes.
_form_set_class($element, array('form-text', 'form-control', 'input-lg-3'));
$extra = '';
if ($element['#autocomplete_path'] && drupal_valid_path($element['#autocomplete_path'])) {
drupal_add_library('system', 'drupal.autocomplete');
$element['#attributes']['class'][] = 'form-autocomplete';
$attributes = array();
$attributes['type'] = 'hidden';
$attributes['id'] = $element['#attributes']['id'] . '-autocomplete';
$attributes['value'] = url($element['#autocomplete_path'], array('absolute' => TRUE));
$attributes['disabled'] = 'disabled';
$attributes['class'][] = 'autocomplete';
$extra = '<input' . drupal_attributes($attributes) . ' />';
}
$output .= '<input' . drupal_attributes($element['#attributes']) . ' />';
return $output . $extra;
}
示例6: get_form_html
protected static function get_form_html($args, $auth, $attributes)
{
// @todo Process the available data to load subsamples (habitats) and associated records correctly.
// toggle the checkboxes to after the label to match the form.
global $indicia_templates;
drupal_add_library('system', 'ui.tooltip', true);
$indicia_templates['check_or_radio_group_item'] = '<li><label for="{itemId}">{caption}</label><input type="{type}" name="{fieldname}" id="{itemId}" value="{value}"{class}{checked}{title} {disabled}/></li>';
// Create an array of custom attributes keyed by caption for easy lookup later
foreach ($attributes as $attr) {
self::$attrsByCaption[strtolower($attr['caption'])] = $attr;
}
// Build a list of the habitat-level attributes as well.
$attributeOpts = array('valuetable' => 'sample_attribute_value', 'attrtable' => 'sample_attribute', 'key' => 'sample_id', 'fieldprefix' => 'smpAttr', 'extraParams' => $auth['read'], 'survey_id' => $args['survey_id'], 'sample_method_id' => $args['habitat_sample_method_id']);
$habitatAttributes = data_entry_helper::getAttributes($attributeOpts, false);
foreach ($habitatAttributes as $attr) {
self::$habitatAttrsByCaption[strtolower($attr['caption'])] = $attr;
}
// load the habitat attribute values, if we have an existing sample
if (!empty(self::$loadedSampleId)) {
self::load_existing(self::$loadedSampleId, $auth);
} else {
data_entry_helper::$javascript .= "indiciaData.existingSubsampleData=[];\n";
}
// output some attribute info we can use for validation & business logic
data_entry_helper::$javascript .= "indiciaData.depthMinLimitAttrNames = " . json_encode(array(self::$attrsByCaption['depth shallow bsl']['fieldname'], self::$attrsByCaption['depth shallow bcd']['fieldname'])) . ";\n";
data_entry_helper::$javascript .= "indiciaData.depthMaxLimitAttrNames = " . json_encode(array(self::$attrsByCaption['depth deepest bsl']['fieldname'], self::$attrsByCaption['depth deepest bcd']['fieldname'])) . ";\n";
data_entry_helper::$javascript .= "indiciaData.driftAttrId = " . self::$attrsByCaption['drift dive?']['attributeId'] . ";\n";
data_entry_helper::$javascript .= "indiciaData.depthCDAttrName = '" . self::$attrsByCaption['tidal correction to chart datum']['fieldname'] . "';\n";
data_entry_helper::$javascript .= "indiciaData.habitatMinDepthSLAttrId = " . self::$habitatAttrsByCaption['upper depth from sea level']['attributeId'] . ";\n";
data_entry_helper::$javascript .= "indiciaData.habitatMaxDepthSLAttrId = " . self::$habitatAttrsByCaption['lower depth from sea level']['attributeId'] . ";\n";
data_entry_helper::$javascript .= "indiciaData.habitatMinDepthCDAttrId = " . self::$habitatAttrsByCaption['upper depth from chart datum']['attributeId'] . ";\n";
data_entry_helper::$javascript .= "indiciaData.habitatMaxDepthCDAttrId = " . self::$habitatAttrsByCaption['lower depth from chart datum']['attributeId'] . ";\n";
return parent::get_form_html($args, $auth, $attributes);
}
示例7: checkbook3_preprocess_html
/**
* Implements hook_preprocess_html
*/
function checkbook3_preprocess_html(&$vars)
{
drupal_add_library('system', 'ui');
drupal_add_css(path_to_theme() . '/css/ie-7.css', array('group' => CSS_THEME, 'weight' => 997, 'browsers' => array('IE' => 'IE 7', '!IE' => FALSE)));
drupal_add_css(path_to_theme() . '/css/ie-8.css', array('group' => CSS_THEME, 'weight' => 998, 'browsers' => array('IE' => 'IE 8', '!IE' => FALSE)));
drupal_add_css(path_to_theme() . '/css/ie-9.css', array('group' => CSS_THEME, 'weight' => 999, 'browsers' => array('IE' => 'IE 9', '!IE' => FALSE)));
}
示例8: bootstrap_sst_textfield
/**
* Overrides theme_textfield().
*/
function bootstrap_sst_textfield($variables)
{
$element = $variables['element'];
$element['#attributes']['type'] = 'text';
element_set_attributes($element, array('id', 'name', 'value', 'size', 'maxlength'));
_form_set_class($element, array('form-text'));
$output = '<input' . drupal_attributes($element['#attributes']) . ' />';
$extra = '';
if ($element['#autocomplete_path'] && drupal_valid_path($element['#autocomplete_path'])) {
drupal_add_library('system', 'drupal.autocomplete');
$element['#attributes']['class'][] = 'form-autocomplete';
$attributes = array();
$attributes['type'] = 'hidden';
$attributes['id'] = $element['#attributes']['id'] . '-autocomplete';
$attributes['value'] = url($element['#autocomplete_path'], array('absolute' => TRUE));
$attributes['disabled'] = 'disabled';
$attributes['class'][] = 'autocomplete';
// Uses icon for autocomplete "throbber".
if ($icon = _bootstrap_icon('refresh')) {
$output = '<div class="input-group">' . $output . '<span class="input-group-addon">' . $icon . '</span></div>';
} else {
$output = '<div class="input-group">' . $output . '<span class="input-group-addon">';
// The throbber's background image must be set here because sites may not
// be at the root of the domain (ie: /) and this value cannot be set via
// CSS.
$output .= '<span class="autocomplete-throbber" style="background-image:url(' . url('misc/throbber.gif') . ')"></span>';
$output .= '</span></div>';
}
$extra = '<input' . drupal_attributes($attributes) . ' />';
}
return $output . $extra;
}
示例9: velocity_preprocess_html
function velocity_preprocess_html(&$vars)
{
$file = 'color-' . theme_get_setting('theme_color') . '-style.css';
drupal_add_css(path_to_theme() . '/css/' . $file, array('group' => CSS_THEME, 'weight' => 115, 'browsers' => array(), 'preprocess' => FALSE));
$file = theme_get_setting('theme_layout') . '-style.css';
drupal_add_css(path_to_theme() . '/css/' . $file, array('group' => CSS_THEME, 'weight' => 116, 'browsers' => array(), 'preprocess' => FALSE));
drupal_add_js('jQuery(document).ready(function($) {
$(window).scroll(function() {
if($(this).scrollTop() != 0) {
$("#toTop").fadeIn();
} else {
$("#toTop").fadeOut();
}
});
$("#toTop").click(function() {
$("body,html").animate({scrollTop:0},800);
});
});', array('type' => 'inline', 'scope' => 'header'));
drupal_add_library('system', 'ui.accordion');
drupal_add_library('system', 'ui.tabs');
drupal_add_library('system', 'ui.progressbar');
drupal_add_js(drupal_get_path('module', 'your_module_name') . '/exposedfilterquick.js', 'module');
}
示例10: add_meta
function add_meta()
{
ctools_include('display-edit', 'panels');
ctools_include('content');
if (empty($this->display->cache_key)) {
$this->cache = panels_edit_cache_get_default($this->display);
}
// @todo we may need an else to load the cache, but I am not sure we
// actually need to load it if we already have our cache key, and doing
// so is a waste of resources.
ctools_include('cleanstring');
$this->clean_key = ctools_cleanstring($this->display->cache_key);
$button = theme('panels_ipe_edit_button', array('class' => 'panels-ipe-startedit', 'text' => t('Customize this page')));
panels_ipe_toolbar_add_button($this->clean_key, 'panels-ipe-startedit', $button);
// panels_ipe_get_cache_key($this->clean_key);
ctools_include('ajax');
ctools_include('modal');
ctools_modal_add_js();
ctools_add_css('panels_dnd', 'panels');
ctools_add_css('panels_admin', 'panels');
ctools_add_js('panels_ipe', 'panels_ipe');
ctools_add_css('panels_ipe', 'panels_ipe');
$settings = array('formPath' => url($this->get_url('save-form')));
drupal_add_js(array('PanelsIPECacheKeys' => array($this->clean_key)), 'setting');
drupal_add_js(array('PanelsIPESettings' => array($this->clean_key => $settings)), 'setting');
drupal_add_library('system', 'ui.draggable');
drupal_add_library('system', 'ui.droppable');
drupal_add_library('system', 'ui.sortable');
// drupal_add_js('misc/ui/jquery.ui.draggable.min.js');
// drupal_add_js('misc/ui/jquery.ui.droppable.min.js');
// drupal_add_js('misc/ui/jquery.ui.sortable.min.js');
// jquery_ui_add(array('ui.draggable', 'ui.droppable', 'ui.sortable'));
parent::add_meta();
}
示例11: uw_boundless_preprocess_html
/**
* Preprocess variables for html.tpl.php
*
* Implements template_preprocess_html(&$variables)
*
* @see system_elements()
* @see html.tpl.php
*/
function uw_boundless_preprocess_html(&$variables)
{
// Adding jQuery UI effects library
drupal_add_library('system', 'effects');
// for other libraries see https://api.drupal.org/api/drupal/modules!system!system.module/function/system_library/7
// // Adding underscore.js
// $options = array();
// $options['type'] = 'external';
// $options['scope'] = 'header';
// $options['group'] = JS_LIBRARY;
// $options['weight'] = -20;
// drupal_add_js('//cdnjs.cloudflare.com/ajax/libs/underscore.js/1.7.0/underscore-min.js', $options);
//
// // Adding backbone.js
// $options = array();
// $options['type'] = 'external';
// $options['scope'] = 'header';
// $options['group'] = JS_LIBRARY;
// $options['weight'] = -19;
// drupal_add_js('//cdnjs.cloudflare.com/ajax/libs/backbone.js/1.1.2/backbone-min.js', $options);
// Adding the UW Alert Banner script
$options = array();
$options['type'] = 'external';
$options['scope'] = 'header';
$options['group'] = JS_THEME;
drupal_add_js('//www.washington.edu/static/alert.js', $options);
}
示例12: add_meta
function add_meta()
{
ctools_include('display-edit', 'panels');
ctools_include('content');
if (empty($this->display->cache_key)) {
$this->cache = panels_edit_cache_get_default($this->display);
}
// @todo we may need an else to load the cache, but I am not sure we
// actually need to load it if we already have our cache key, and doing
// so is a waste of resources.
ctools_include('cleanstring');
$this->clean_key = ctools_cleanstring($this->display->cache_key);
$button = array('#type' => 'link', '#title' => t('Customize this page'), '#href' => $this->get_url('save_form'), '#id' => 'panels-ipe-customize-page', '#attributes' => array('class' => array('panels-ipe-startedit', 'panels-ipe-pseudobutton')), '#ajax' => array('progress' => 'throbber', 'ipe_cache_key' => $this->clean_key), '#prefix' => '<div class="panels-ipe-pseudobutton-container">', '#suffix' => '</div>');
panels_ipe_toolbar_add_button($this->clean_key, 'panels-ipe-startedit', $button);
// @todo this actually should be an IPE setting instead.
if (user_access('change layouts in place editing')) {
$button = array('#type' => 'link', '#title' => t('Change layout'), '#href' => $this->get_url('change_layout'), '#attributes' => array('class' => array('panels-ipe-change-layout', 'panels-ipe-pseudobutton', 'ctools-modal-layout')), '#ajax' => array('progress' => 'throbber', 'ipe_cache_key' => $this->clean_key), '#prefix' => '<div class="panels-ipe-pseudobutton-container">', '#suffix' => '</div>');
panels_ipe_toolbar_add_button($this->clean_key, 'panels-ipe-change-layout', $button);
}
ctools_include('ajax');
ctools_include('modal');
ctools_modal_add_js();
ctools_add_css('panels_dnd', 'panels');
ctools_add_css('panels_admin', 'panels');
ctools_add_css('panels_ipe', 'panels_ipe');
// Add the JavaScript for the IPE. This must go as early as possible so
// that its behaviors run first, allowing it to clone parts of the DOM
// before other behaviors have been applied to them.
drupal_add_js(drupal_get_path('module', 'panels_ipe') . '/js/panels_ipe.js', array('group' => JS_LIBRARY, 'weight' => -1000));
drupal_add_js(array('PanelsIPECacheKeys' => array($this->clean_key)), 'setting');
drupal_add_library('system', 'ui.draggable');
drupal_add_library('system', 'ui.droppable');
drupal_add_library('system', 'ui.sortable');
parent::add_meta();
}
示例13: candidato_form_alter
/**
* @file
* The primary PHP file for this theme.
*/
function candidato_form_alter(&$form, &$form_state, $form_id)
{
if ($form_id == 'webform_client_form_23') {
// $form['#attributes']['class'][] = 'form-horizontal';
}
drupal_add_library('system', 'ui.datepicker');
}
示例14: favrskovtheme_preprocess_html
/**
* Preprocess html.tpl.php
*/
function favrskovtheme_preprocess_html(&$vars)
{
drupal_add_library('system', 'ui.widget');
drupal_add_js(libraries_get_path('swiper') . '/idangerous.swiper.min.js', array('scope' => 'header', 'group' => JS_LIBRARY, 'every_page' => TRUE));
drupal_add_css('https://fast.fonts.net/cssapi/cb2b1123-533e-44b1-af78-e3702f6bd579.css', array('type' => 'external', 'group' => 'CSS_THEME', 'every_page' => TRUE, 'media' => 'projection, screen'));
$jwplayer = drupal_get_js('jwplayer');
$vars['jwplayer'] = $jwplayer;
// Added meta tag for IE.
$meta_ie_render_engine = array('#type' => 'html_tag', '#tag' => 'meta', '#attributes' => array('content' => 'IE=10', 'http-equiv' => 'X-UA-Compatible'));
// Add header meta tag for IE to head
drupal_add_html_head($meta_ie_render_engine, 'meta_ie_render_engine');
$multisite_links = theme_get_setting('favrskovtheme_multisite_links');
if (!empty($multisite_links)) {
$vars['classes_array'][] = theme_get_setting('favrskovtheme_multisite_links');
}
$header_links = theme_get_setting('favrskovtheme_header_links');
if (!empty($header_links)) {
$vars['classes_array'][] = $header_links;
}
if (!empty($vars['background'])) {
$vars['classes_array'][] = 'dynamic-background';
}
// jQuery custom content scroller
drupal_add_js(libraries_get_path('malihu') . '/js/minified/jquery.mCustomScrollbar.min.js', array('scope' => 'header', 'group' => JS_LIBRARY, 'every_page' => TRUE));
drupal_add_css(libraries_get_path('malihu') . '/jquery.mCustomScrollbar.min.css', array('scope' => 'header', 'group' => CSS_THEME, 'every_page' => TRUE));
}
示例15: commerce_kickstart_theme_preprocess_html
/**
* Preprocess variables for html.tpl.php
*
* @see system_elements()
* @see html.tpl.php
*/
function commerce_kickstart_theme_preprocess_html(&$variables)
{
// Add conditional stylesheets for IE
drupal_add_css(path_to_theme() . '/css/commerce-kickstart-theme-ie-lte-8.css', array('group' => CSS_THEME, 'weight' => 23, 'browsers' => array('IE' => 'lte IE 8', '!IE' => FALSE), 'preprocess' => FALSE));
drupal_add_css(path_to_theme() . '/css/commerce-kickstart-theme-ie-lte-7.css', array('group' => CSS_THEME, 'weight' => 24, 'browsers' => array('IE' => 'lte IE 7', '!IE' => FALSE), 'preprocess' => FALSE));
// Add external libraries.
drupal_add_library('commerce_kickstart_theme', 'selectnav');
}