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>';
}
示例#2
0
function iwebkit_select($element)
{
    $select = '';
    $size = $element['#size'] ? ' size="' . $element['#size'] . '"' : '';
    _form_set_class($element, array('form-select'));
    $multiple = $element['#multiple'];
    return theme('form_element', $element, '<ul class="pageitem"><li class="form"><select name="' . $element['#name'] . '' . ($multiple ? '[]' : '') . '"' . ($multiple ? ' multiple="multiple" ' : '') . drupal_attributes($element['#attributes']) . ' id="' . $element['#id'] . '" ' . $size . '>' . form_select_options($element) . '</select><span class="arrow"></span></li></ul>');
}
示例#3
0
function materialize_select($variables)
{
    $classes = array('browser-default');
    if (!isset($variables['element']['#attributes']['class'])) {
        $variables['element']['#attributes'] = array('class' => $classes);
    } else {
        $variables['element']['#attributes']['class'] = array_merge($variables['element']['#attributes']['class'], $classes);
    }
    return '<select' . backdrop_attributes($variables['element']['#attributes']) . '>' . form_select_options($variables['element']) . '</select>';
}
示例#4
0
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>';
}
示例#5
0
/**
 * Fork of core form_select_options.
 */
function _foundation_access_form_select_options($element, $choices = NULL)
{
    if (!isset($choices)) {
        $choices = $element['#options'];
    }
    // array_key_exists() accommodates the rare event where $element['#value'] is NULL.
    // isset() fails in this situation.
    $value_valid = isset($element['#value']) || array_key_exists('#value', $element);
    $value_is_array = $value_valid && is_array($element['#value']);
    $options = '';
    foreach ($choices as $key => $choice) {
        if (is_array($choice)) {
            $options .= '<optgroup label="' . check_plain($key) . '">';
            $options .= form_select_options($element, $choice);
            $options .= '</optgroup>';
        } elseif (is_object($choice)) {
            $options .= form_select_options($element, $choice->option);
        } else {
            $key = (string) $key;
            if ($value_valid && (!$value_is_array && (string) $element['#value'] === $key || $value_is_array && in_array($key, $element['#value']))) {
                $selected = ' selected="selected"';
            } else {
                $selected = '';
            }
            $extra = '';
            // support for materialize options
            if (isset($element['#materialize']) && $key != '_none') {
                $extra = 'class="' . $element['#materialize']['class'] . '"';
                // add in the path to the images w/ the option being part of the
                // name of the file. This is very specific to how we want to structure
                // choice options to have an icon_path counterpart but it's not
                // that hard to do so whatever.
                if (isset($element['#materialize']['icon_path'])) {
                    $extra .= ' data-icon="' . base_path() . $element['#materialize']['icon_path'] . drupal_strtolower(str_replace('/', '-', str_replace(' ', '', check_plain($choice)))) . '.png"';
                }
            }
            $options .= '<option ' . $extra . ' value="' . check_plain($key) . '"' . $selected . '>' . check_plain($choice) . '</option>';
        }
    }
    return $options;
}
示例#6
0
function mothership_select($variables)
{
    $element = $variables['element'];
    element_set_attributes($element, array('id', 'name', 'size'));
    if (!theme_get_setting('mothership_classes_form_input')) {
        _form_set_class($element, array('form-select'));
    }
    return '<select' . drupal_attributes($element['#attributes']) . '>' . form_select_options($element) . '</select>';
}
示例#7
0
/**
 * Overwrite theme_select().
 */
function bht_theme_select($variables)
{
    $element = $variables['element'];
    element_set_attributes($element, array('id', 'name', 'size'));
    if (isset($element['#required']) && $element['#required']) {
        $element['#attributes']['class'][] = 'required';
    }
    return '<select' . drupal_attributes($element['#attributes']) . '>' . form_select_options($element) . '</select>';
}
示例#8
0
 /**
  * Theme the output of the attach element.
  */
 public static function element($variables)
 {
     $element = $variables['element'];
     $options = form_select_options($element['filename']);
     $option_output = '';
     foreach ($options as $key => $value) {
         $option_output .= '<option value=' . $value["value"] . '>' . $value["label"] . '</option>';
     }
     if (isset($element['attach_message'])) {
         $output = $element['attach_message']['#markup'];
     } else {
         $size = !empty($element['filename']['#size']) ? ' size="' . $element['filename']['#size'] . '"' : '';
         $element['filename']['#attributes']['class'][] = 'form-select';
         $multiple = !empty($element['#multiple']);
         $output = '<select name="' . $element['filename']['#name'] . '' . ($multiple ? '[]' : '') . '"' . ($multiple ? ' multiple="multiple" ' : '') . new Attribute($element['filename']['#attributes']) . ' id="' . $element['filename']['#id'] . '" ' . $size . '>' . $option_output . '</select>';
     }
     $output .= drupal_render($element['attach']);
     $element['#children'] = $output;
     $element['#theme_wrappers'] = array('form_element');
     return '<div class="filefield-source filefield-source-attach clear-block">' . drupal_render($element) . '</div>';
 }
示例#9
0
function rcredits_select($variables)
{
    \element_set_attributes($variables['element'], array('id', 'name', 'size'));
    extract(rcElement($variables, 'attributes class'));
    $class[] = 'form-control';
    return u\tag('select', \form_select_options($variables['element']), $attributes + compact('class'));
}
示例#10
0
function neb_select($variables)
{
    $element = $variables['element'];
    element_set_attributes($element, array('id', 'name', 'size'));
    return '<select' . drupal_attributes($element['#attributes']) . '>' . form_select_options($element) . '</select>';
}
示例#11
0
/**
 * Override select widget theme function to add Bootstrap form-control.
 */
function bootsmacss_select($variables)
{
    $element = $variables['element'];
    $element['#attributes']['class'][] = 'form-control';
    element_set_attributes($element, array('id', 'name', 'size'));
    _form_set_class($element, array('form-select'));
    return '<select' . drupal_attributes($element['#attributes']) . '>' . form_select_options($element) . '</select>';
}
示例#12
0
/**
 *  Implements theme_select().
 */
function hasta_select($variables)
{
    $element = $variables['element'];
    element_set_attributes($element, array('id', 'name', 'size'));
    if ($element['#title_display'] == 'none') {
        //$element['#options'][''] = $element['#title'];
    }
    //_form_set_class($element, array('form-select'));
    $output = '<select' . drupal_attributes($element['#attributes']) . '>' . form_select_options($element) . '</select>';
    $output = '<div class = "section select">' . $output . '<i class="arrow"></i></div>';
    return $output;
}
示例#13
0
function bartik_sub_select($variables)
{
    $element = $variables['element'];
    element_set_attributes($element, array('id', 'name', 'size'));
    /*****************************Added 'form-control' class from bootstrap.css *****************************/
    _form_set_class($element, array('form-select', 'form-control'));
    return '<select' . drupal_attributes($element['#attributes']) . '>' . form_select_options($element) . '</select>';
}
示例#14
0
<?php

$element = $variables['element'];
element_set_attributes($element, array('id', 'name', 'size'));
_form_set_class($element, array('form-control'));
// Add aria-describedby attribute for screen readers.
if (!empty($element['#description'])) {
    $element['#attributes']['aria-describedby'] = 'help-' . $element['#id'];
}
print '<select' . drupal_attributes($element['#attributes']) . '>' . form_select_options($element) . '</select>';