当前位置: 首页>>代码示例>>PHP>>正文


PHP element_set_attributes函数代码示例

本文整理汇总了PHP中element_set_attributes函数的典型用法代码示例。如果您正苦于以下问题:PHP element_set_attributes函数的具体用法?PHP element_set_attributes怎么用?PHP element_set_attributes使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了element_set_attributes函数的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;
}
开发者ID:kymunr,项目名称:DrupalProject,代码行数:35,代码来源:misc.php

示例2: 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;
}
开发者ID:atssc-scdata,项目名称:bootstrap_sst,代码行数:35,代码来源:textfield.func.php

示例3: bootstrap_preprocess_bootstrap_panel

/**
 * Pre-processes variables for the "bootstrap_panel" theme hook.
 *
 * See template for list of available variables.
 *
 * @see bootstrap-panel.tpl.php
 *
 * @ingroup theme_preprocess
 */
function bootstrap_preprocess_bootstrap_panel(&$variables)
{
    $element =& $variables['element'];
    // Set the element's attributes.
    element_set_attributes($element, array('id'));
    // Retrieve the attributes for the element.
    $attributes =& _bootstrap_get_attributes($element);
    // Add panel and panel-default classes.
    $attributes['class'][] = 'panel';
    $attributes['class'][] = 'panel-default';
    // states.js requires form-wrapper on fieldset to work properly.
    $attributes['class'][] = 'form-wrapper';
    // Handle collapsible panels.
    $variables['collapsible'] = FALSE;
    if (isset($element['#collapsible'])) {
        $variables['collapsible'] = $element['#collapsible'];
    }
    $variables['collapsed'] = FALSE;
    if (isset($element['#collapsed'])) {
        $variables['collapsed'] = $element['#collapsed'];
        // Remove collapsed class since we only want it to apply to the inner element
        if ($index = array_search('collapsed', $attributes['class'])) {
            unset($attributes['class'][$index]);
            $attributes['class'] = array_values($attributes['class']);
        }
    }
    // Force grouped fieldsets to not be collapsible (for vertical tabs).
    if (!empty($element['#group'])) {
        $variables['collapsible'] = FALSE;
        $variables['collapsed'] = FALSE;
    }
    // Collapsible elements need an ID, so generate one for the fieldset's inner element.
    if ($variables['collapsible']) {
        // Generate an ID for the outer element if necessary.
        if (!isset($element['#id'])) {
            $element['#id'] = drupal_html_id('bootstrap-panel');
        }
        $variables['id_inner'] = drupal_html_id($element['#id'] . '-inner');
    }
    $variables['target'] = NULL;
    if (isset($element['#id'])) {
        $attributes['id'] = $element['#id'];
        if (isset($variables['id_inner'])) {
            $variables['target'] = '#' . $variables['id_inner'];
        }
    }
    // Build the panel content.
    $variables['content'] = $element['#children'];
    if (isset($element['#value'])) {
        $variables['content'] .= $element['#value'];
    }
    // Iterate over optional variables.
    $keys = array('description', 'prefix', 'suffix', 'title');
    foreach ($keys as $key) {
        $variables[$key] = !empty($element["#{$key}"]) ? $element["#{$key}"] : FALSE;
    }
    // Add the attributes.
    $variables['attributes'] = $attributes;
}
开发者ID:himolde,项目名称:sjoportalen,代码行数:68,代码来源:bootstrap-panel.vars.php

示例4: Cancilleria_button

/**
 * Returns HTML for a button form element.
 *
 * @param $variables
 *   An associative array containing:
 *   - element: An associative array containing the properties of the element.
 *     Properties used: #attributes, #button_type, #name, #value.
 *
 * @ingroup themeable
 */
function Cancilleria_button($variables)
{
    $element = $variables['element'];
    $element['#attributes']['type'] = 'submit';
    element_set_attributes($element, array('id', 'name', 'value'));
    $element['#attributes']['class'][] = 'form-' . $element['#button_type'] . ' Cancilleria_button';
    if (!empty($element['#attributes']['disabled'])) {
        $element['#attributes']['class'][] = 'form-button-disabled';
    }
    return '<input' . drupal_attributes($element['#attributes']) . ' />';
}
开发者ID:estebanpcastro,项目名称:ColombiaNosUne,代码行数:21,代码来源:drupal7_theme_methods.php

示例5: blogbuzz_button

function blogbuzz_button($vars)
{
    $element = $vars['element'];
    $element['#attributes']['type'] = 'submit';
    element_set_attributes($element, array('id', 'name', 'value'));
    $element['#attributes']['class'][] = 'form-' . $element['#button_type'];
    if (!empty($element['#attributes']['disabled'])) {
        $element['#attributes']['class'][] = 'form-button-disabled';
    }
    return '<span class="button"><input' . drupal_attributes($element['#attributes']) . ' /></span>';
}
开发者ID:alexdbrown,项目名称:disney_movies,代码行数:11,代码来源:template.php

示例6: gavias_laikafood_button

/**
 * Add Bootstrap classes to button elements.
 */
function gavias_laikafood_button($variables)
{
    $element = $variables['element'];
    $element['#attributes']['type'] = 'submit';
    element_set_attributes($element, array('id', 'name', 'value'));
    $element['#attributes']['class'][] = 'btn-primary btn form-' . $element['#button_type'];
    if (!empty($element['#attributes']['disabled'])) {
        $element['#attributes']['class'][] = 'form-button-disabled';
    }
    return '<input' . drupal_attributes($element['#attributes']) . ' />';
}
开发者ID:ucaka,项目名称:forestway,代码行数:14,代码来源:template.functions.php

示例7: drupal_13584_button

function drupal_13584_button($variables)
{
    $element = $variables['element'];
    $element['#attributes']['type'] = 'submit';
    element_set_attributes($element, array('id', 'name', 'value'));
    $element['#attributes']['class'][] = 'form-' . $element['#button_type'] . ' free-templates-lt-button';
    if (!empty($element['#attributes']['disabled'])) {
        $element['#attributes']['class'][] = 'form-button-disabled';
    }
    return '<span class="free-templates-lt-button-wrapper">' . '<span class="free-templates-lt-button-l"></span>' . '<span class="free-templates-lt-button-r"></span>' . '<input' . drupal_attributes($element['#attributes']) . ' />' . '</span>';
}
开发者ID:Lanou94,项目名称:intranet,代码行数:11,代码来源:drupal7_theme_methods.php

示例8: myu_myu_textfield_login_pass

/**
 * Theme function implementation for myu_textfield_login_pass.
 */
function myu_myu_textfield_login_pass($variables)
{
    $element = $variables['element'];
    $element['#attributes']['type'] = 'password';
    element_set_attributes($element, array('id', 'name', 'value', 'size', 'maxlength'));
    _form_set_class($element, array('form-text'));
    $output = '<label class="control-label visible-ie8 visible-ie9">Username</label><div class="input-icon"><i class="fa fa-lock"></i>';
    $output .= '<input' . drupal_attributes($element['#attributes']) . ' />';
    $output .= '</div>';
    return $output;
}
开发者ID:verbruggenalex,项目名称:mediayoutubeupload,代码行数:14,代码来源:template.php

示例9: adaptivetheme_admin_button

/**
* Theme button. Override AT Core because it screws with Views.
*/
function adaptivetheme_admin_button($vars)
{
    $element = $vars['element'];
    $element['#attributes']['type'] = 'submit';
    element_set_attributes($element, array('id', 'name', 'value'));
    $element['#attributes']['class'][] = 'form-' . $element['#button_type'];
    if (!empty($element['#attributes']['disabled'])) {
        $element['#attributes']['class'][] = 'form-button-disabled';
    }
    return '<input' . drupal_attributes($element['#attributes']) . ' />';
}
开发者ID:roger06,项目名称:plato,代码行数:14,代码来源:template.php

示例10: opcaim_select

function opcaim_select($variables) {
    $element = $variables ['element'];
    element_set_attributes($element, array('id', 'name', 'size'));
    _form_set_class($element, array('form-select'));
    _form_set_class($divelement, array('form-select styled-select'));

    if (in_array('error', $element ['#attributes']['class'])) {
        _form_set_class($divelement, array('errorCustomSelect'));
    }

    return '<select' . drupal_attributes($element ['#attributes']) . '>' . form_select_options($element) . '</select>';
}
开发者ID:HamzaBendidane,项目名称:prel,代码行数:12,代码来源:template.php

示例11: analytics_portal_password

function analytics_portal_password($variables)
{
    $element = $variables['element'];
    $element['#attributes']['type'] = 'password';
    element_set_attributes($element, array('id', 'name', 'size', 'maxlength'));
    _form_set_class($element, array('form-text', 'form-control'));
    $output = '';
    // login form adding glyphicon.
    if ($element['#name'] == 'pass') {
        $output = '<span class="input-group-addon"><span class="glyphicon glyphicon-eye-close"></span></span>';
    }
    return $output . '<input' . drupal_attributes($element['#attributes']) . ' />';
}
开发者ID:hoqkhanh,项目名称:analytics_portal,代码行数:13,代码来源:template.php

示例12: nprdd_ui_button

/**
 * Implements theme_button().
 */
function nprdd_ui_button($vars)
{
    $element = $vars['element'];
    $element['#attributes']['type'] = 'submit';
    element_set_attributes($element, array('id', 'name', 'value'));
    $element['#attributes']['class'][] = 'form-' . $element['#button_type'];
    if (!empty($element['#attributes']['disabled'])) {
        $element['#attributes']['class'][] = 'form-button-disabled';
    }
    // Add class to pull in Foundation stuff.
    $element['#attributes']['class'][] = 'button';
    return '<input' . drupal_attributes($element['#attributes']) . ' />';
}
开发者ID:natemow,项目名称:samples,代码行数:16,代码来源:template.php

示例13: ofen_form

/**
 * Returns HTML for a form.
 *
 * @param $variables
 *   An associative array containing:
 *   - element: An associative array containing the properties of the element.
 *     Properties used: #action, #method, #attributes, #children
 *
 * @ingroup themeable
 */
function ofen_form($variables)
{
    $element = $variables['element'];
    if (isset($element['#action'])) {
        $element['#attributes']['action'] = drupal_strip_dangerous_protocols($element['#action']);
    }
    element_set_attributes($element, array('method', 'id'));
    if (empty($element['#attributes']['accept-charset'])) {
        $element['#attributes']['accept-charset'] = "UTF-8";
    }
    // CHANGED: Anonymous DIV to satisfy XHTML compliance.
    //    return '<form' . drupal_attributes($element['#attributes']) . '><div>' . $element['#children'] . '</div></form>';
    return '<form' . drupal_attributes($element['#attributes']) . '>' . $element['#children'] . '</form>';
}
开发者ID:MfN-Berlin,项目名称:Ofen,代码行数:24,代码来源:template.php

示例14: expressadmin_button

/**
 * Overrides theme_button().
 */
function expressadmin_button($variables)
{
    $element = $variables['element'];
    $element['#attributes']['type'] = 'submit';
    element_set_attributes($element, array('id', 'name', 'value'));
    $element['#attributes']['class'][] = 'form-' . $element['#button_type'];
    if (!empty($element['#attributes']['disabled'])) {
        $element['#attributes']['class'][] = 'form-button-disabled';
    }
    $element['#attributes']['class'][] = 'btn';
    // Colorize button.
    _expressadmin_colorize_button($element);
    return '<input' . drupal_attributes($element['#attributes']) . ' />';
}
开发者ID:CuBoulder,项目名称:express,代码行数:17,代码来源:template.php

示例15: bootstrap_preprocess_button

/**
 * Implements hook_preprocess_button().
 */
function bootstrap_preprocess_button(&$vars)
{
    $element =& $vars['element'];
    // Set the element's attributes.
    element_set_attributes($element, array('id', 'name', 'value', 'type'));
    // Add the base Bootstrap button class.
    $element['#attributes']['class'][] = 'btn';
    // Colorize button.
    _bootstrap_colorize_button($element);
    // Add in the button type class.
    $element['#attributes']['class'][] = 'form-' . $element['#button_type'];
    // Ensure that all classes are unique, no need for duplicates.
    $element['#attributes']['class'] = array_unique($element['#attributes']['class']);
}
开发者ID:rhabbachi,项目名称:data_starter,代码行数:17,代码来源:button.vars.php


注:本文中的element_set_attributes函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。