本文整理汇总了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;
}
示例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;
}
示例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;
}
示例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']) . ' />';
}
示例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>';
}
示例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']) . ' />';
}
示例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>';
}
示例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;
}
示例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']) . ' />';
}
示例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>';
}
示例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']) . ' />';
}
示例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']) . ' />';
}
示例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>';
}
示例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']) . ' />';
}
示例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']);
}