本文整理汇总了PHP中_form_set_class函数的典型用法代码示例。如果您正苦于以下问题:PHP _form_set_class函数的具体用法?PHP _form_set_class怎么用?PHP _form_set_class使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了_form_set_class函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: 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;
}
示例2: 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;
}
示例3: gitp_select
function gitp_select($variables)
{
$element = $variables['element'];
element_set_attributes($element, array('id', 'name', 'size'));
_form_set_class($element, array('form-select'));
return '<select' . drupal_attributes($element['#attributes']) . ' class="form-control">' . form_select_options($element) . '</select>';
}
示例4: 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;
}
示例5: 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>';
}
示例6: 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']) . ' />';
}
示例7: nomad_password
function nomad_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 = '<input' . drupal_attributes($element['#attributes']) . ' />';
if ($element['#name'] == 'pass') {
$prefix1 = '<div class="input-group margin-bottom-sm"><span class="input-group-addon"><i class="fa fa-lock fa-fw"></i></span>';
$suffix1 = "</div>";
$output = $prefix1 . $output . $suffix1;
}
return $output;
}
示例8: mothership_checkbox
function mothership_checkbox($element)
{
_form_set_class($element, array('checkbox'));
$checkbox = '<input ';
$checkbox .= 'type="checkbox" ';
$checkbox .= 'name="' . $element['#name'] . '" ';
$checkbox .= 'id="' . $element['#id'] . '" ';
$checkbox .= 'value="' . $element['#return_value'] . '" ';
$checkbox .= $element['#value'] ? ' checked="checked" ' : ' ';
$checkbox .= drupal_attributes($element['#attributes']) . ' />';
if (!is_null($element['#title'])) {
$checkbox = '<label class="form-option" for="' . $element['#id'] . '">' . $checkbox . ' ' . $element['#title'] . '</label>';
}
unset($element['#title']);
return theme('form_element', $element, $checkbox);
}
示例9: subtpl_radio
/**
* theme radio - support icons
*/
function subtpl_radio($variables)
{
$element = $variables['element'];
$element['#attributes']['type'] = 'radio';
element_set_attributes($element, array('id', 'name', '#return_value' => 'value'));
if (!isset($element['#id'])) {
$id = 'radio-' . rand(0, 1000);
$element['#id'] = $id;
$element['#attributes']['id'] = $id;
}
if (isset($element['#return_value']) && $element['#value'] !== FALSE && $element['#value'] == $element['#return_value']) {
$element['#attributes']['checked'] = 'checked';
}
$label = isset($element['#title']) && $element['#title_display'] == 'after' ? '' : '<label for="' . $element['#id'] . '"></label>';
_form_set_class($element, array('form-radio'));
$icon = substr($element['#return_value'], 0, 5) == "icon-" ? '<span class="iblock icon ' . $element['#return_value'] . '"> </span>' : '';
return $icon . '<input' . drupal_attributes($element['#attributes']) . ' />' . $label;
}
示例10: ting_textarea
/**
* TEXTAREAS
*/
function ting_textarea($variables)
{
$element = $variables['element'];
$element['#attributes']['name'] = $element['#name'];
$element['#attributes']['id'] = $element['#id'];
$element['#attributes']['cols'] = $element['#cols'];
$element['#attributes']['rows'] = 8;
_form_set_class($element, array('form-textarea'));
$wrapper_attributes = array('class' => array('form-textarea-wrapper'));
// Add resizable behavior.
if (!empty($element['#resizable'])) {
$wrapper_attributes['class'][] = 'resizable';
}
$output = '<div' . drupal_attributes($wrapper_attributes) . '>';
$output .= '<textarea' . drupal_attributes($element['#attributes']) . '>' . check_plain($element['#value']) . '</textarea>';
$output .= '</div>';
return $output;
}
示例11: evolve_textfield
/**
* Overrides theme_textfield().
*/
function evolve_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';
$output = '<div class="input-group">' . $output . '<span class="input-group-addon">' . _bootstrap_icon('refresh') . '</span></div>';
$extra = '<input' . drupal_attributes($attributes) . ' />';
}
return $output . $extra;
}
示例12: futurium_isa_theme_textarea
function futurium_isa_theme_textarea($variables) {
$element = $variables['element'];
element_set_attributes($element, array('id', 'name', 'cols', 'rows'));
_form_set_class($element, array('form-textarea'));
$wrapper_attributes = array(
'class' => array('form-textarea-wrapper'),
);
// Add resizable behavior.
if (!empty($element['#resizable'])) {
drupal_add_library('system', 'drupal.textarea');
$wrapper_attributes['class'][] = 'resizable';
}
$output = '<div' . drupal_attributes($wrapper_attributes) . '>';
$output .= '<textarea' . drupal_attributes($element['#attributes']) . '>' . check_plain($element['#value']) . '</textarea>';
$output .= '</div>';
return $output;
}
示例13: bht_theme_textfield
/**
* Overwrite theme_textfield().
*/
function bht_theme_textfield($variables)
{
$element = $variables['element'];
$element['#attributes']['type'] = 'text';
element_set_attributes($element, array('id', 'name', 'value', 'size', 'maxlength'));
_form_set_class($element, '');
$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;
}
示例14: progressive_sub_select
/**
* Implements theme_select().
*/
function progressive_sub_select($variables)
{
_form_set_class($variables['element'], array('form-control'));
return theme_select($variables);
}
示例15: iwebkit_format_bigfield
function iwebkit_format_bigfield($element, $type)
{
$size = empty($element['#size']) ? '' : ' size="' . $element['#size'] . '"';
$maxlength = empty($element['#maxlength']) ? '' : ' maxlength="' . $element['#maxlength'] . '"';
$class = array('form-text');
$extra = '';
$output = '';
$placeholder = '';
/* Wrap in iWebKit li */
$output .= '<li class="bigfield">';
if (!empty($element['#title'])) {
$title = filter_xss_admin($element['#title']);
$placeholder = 'placeholder="' . $title . '"';
}
if ($element['#autocomplete_path'] && menu_valid_path(array('link_path' => $element['#autocomplete_path']))) {
drupal_add_js('misc/autocomplete.js');
$class[] = 'form-autocomplete';
$extra = '<input class="autocomplete" type="hidden" id="' . $element['#id'] . '-autocomplete" value="' . check_url(url($element['#autocomplete_path'], array('absolute' => TRUE))) . '" disabled="disabled" />';
}
_form_set_class($element, $class);
if (isset($element['#field_prefix'])) {
$output .= '<span class="field-prefix">' . $element['#field_prefix'] . '</span> ';
}
$output .= '<input type="' . $type . '"' . $maxlength . ' name="' . $element['#name'] . '" id="' . $element['#id'] . '"' . $size . ' value="' . check_plain($element['#value']) . '"' . drupal_attributes($element['#attributes']) . ' ' . $placeholder . ' />';
if (isset($element['#field_suffix'])) {
$output .= ' <span class="field-suffix">' . $element['#field_suffix'] . '</span>';
}
$output .= '</li>';
return $output . $extra;
}