/**
 * 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;
}
Exemple #2
0
/**
 * 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;
}
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>';
}
/**
 * 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;
}
Exemple #5
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>';
}
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']) . ' />';
}
Exemple #7
0
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;
}
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);
}
/**
 * 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'] . '">&nbsp;</span>' : '';
    return $icon . '<input' . drupal_attributes($element['#attributes']) . ' />' . $label;
}
Exemple #10
0
/**
 * 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;
}
Exemple #11
0
/**
 * 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;
}
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;
}
Exemple #13
0
/**
 * 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;
}
Exemple #14
0
/**
 *  Implements theme_select().
 */
function progressive_sub_select($variables)
{
    _form_set_class($variables['element'], array('form-control'));
    return theme_select($variables);
}
Exemple #15
0
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;
}
<?php

$element = $variables['element'];
element_set_attributes($element, array('id', 'name', 'cols', 'rows'));
_form_set_class($element, array('form-control', 'form-item'));
$wrapper_attributes = array('class' => array('form-textarea-wrapper'));
// When editing a block textarea, Ckeditor will remove some HTML code from the
// textarea. This will remove the Ckeditor module/library from the form so
// we can maintain the HTML code entered in the textarea.
if (!empty($element['#title']) && $element['#title'] == 'Block body') {
    $path = explode('/', current_path());
    $manage_block = ($path[2] = 'block' && $path[3] == 'manage') ? TRUE : FALSE;
    if ($manage_block && isset($element['#pre_render'])) {
        foreach ($element['#pre_render'] as $key => $pre_render) {
            if ($pre_render == 'ckeditor_pre_render_text_format') {
                foreach ($element['#attributes']['class'] as $class_key => $class) {
                    if ($class == 'ckeditor-mod') {
                        unset($element['#attributes']['class'][$class_key]);
                    }
                }
                foreach ($element['#attached']['css'] as $attached_css_key => $attached_css) {
                    if ($attached_css == 'sites/all/modules/contrib/ckeditor/css/ckeditor.editor.css') {
                        if (count($element['#attached']['css']) == '1') {
                            unset($element['#attached']['css']);
                        } else {
                            unset($element['#attached']['css'][$attached_css_key]);
                        }
                    }
                }
                unset($element['#pre_render'][$key]);
            }
/**
 * 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>';
}
Exemple #18
0
/**
 * Implements theme_select().
 */
function foundation_access_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']) . '>' . _foundation_access_form_select_options($element) . '</select>';
}
Exemple #19
0
function cca_textarea($variables)
{
    $element = $variables['element'];
    element_set_attributes($element, array('id', 'name', 'cols', 'rows'));
    _form_set_class($element, array('form-textarea', 'form-control'));
    $wrapper_attributes = array('class' => array('form-textarea-wrapper'));
    $output = '<div' . drupal_attributes($wrapper_attributes) . '>';
    $output .= '<textarea' . drupal_attributes($element['#attributes']) . '>' . check_plain($element['#value']) . '</textarea>';
    $output .= '</div>';
    return $output;
}
/**
 * Overriding theme_fieldset()
 */
function glossy_fieldset($variables) {
  $element = $variables['element'];
  element_set_attributes($element, array('id'));
  _form_set_class($element, array('form-wrapper'));
	
	// make all filter guidelines collapsible and collapsed by default
	if (in_array('filter-wrapper', $element['#attributes']['class'])) {
		array_push($element['#attributes']['class'], 'collapsible', 'collapsed');
	}

  $output = '<fieldset' . drupal_attributes($element['#attributes']) . '>';
  if (!empty($element['#title'])) {
    // Always wrap fieldset legends in a SPAN for CSS positioning.
    $output .= '<legend><span class="fieldset-legend">' . $element['#title'] . '</span></legend>';
  }
  $output .= '<div class="fieldset-wrapper">';
  if (!empty($element['#description'])) {
    $output .= '<div class="fieldset-description">' . $element['#description'] . '</div>';
  }
  $output .= $element['#children'];
  if (isset($element['#value'])) {
    $output .= $element['#value'];
  }
  $output .= '</div>';
  $output .= "</fieldset>\n";
  return $output;
}
/**
 * Overides theme_radio
 */
function innovation_radio($variables)
{
    $element = $variables['element'];
    $element['#attributes']['type'] = 'radio';
    element_set_attributes($element, array('id', 'name', '#return_value' => 'value'));
    if (isset($element['#return_value']) && $element['#value'] !== FALSE && $element['#value'] == $element['#return_value']) {
        $element['#attributes']['checked'] = 'checked';
    }
    _form_set_class($element, array('form-radio'));
    return '<input' . drupal_attributes($element['#attributes']) . ' /><span class="outer-wrap"><i class="fa fa-circle"></i></span>';
}
/**
 * @file
 * This file is empty by default because the base theme chain (Alpha & Omega) provides
 * all the basic functionality. However, in case you wish to customize the output that Drupal
 * generates through Alpha & Omega this file is a good place to do so.
 *
 * Alpha comes with a neat solution for keeping this file as clean as possible while the code
 * for your subtheme grows. Please read the README.txt in the /preprocess and /process subfolders
 * for more information on this topic.
 */
function vp_theme_select_as_links($vars)
{
    $element = $vars['element'];
    $output = '';
    $name = $element['#name'];
    // Collect selected values so we can properly style the links later
    $selected_options = array();
    if (empty($element['#value'])) {
        if (!empty($element['#default_values'])) {
            $selected_options[] = $element['#default_values'];
        }
    } else {
        $selected_options[] = $element['#value'];
    }
    // Add to the selected options specified by Views whatever options are in the
    // URL query string, but only for this filter
    $urllist = parse_url(request_uri());
    if (isset($urllist['query'])) {
        $query = array();
        parse_str(urldecode($urllist['query']), $query);
        foreach ($query as $key => $value) {
            if ($key != $name) {
                continue;
            }
            if (is_array($value)) {
                // This filter allows multiple selections, so put each one on the selected_options array
                foreach ($value as $option) {
                    $selected_options[] = $option;
                }
            } else {
                $selected_options[] = $value;
            }
        }
    }
    // Clean incoming values to prevent XSS attacks
    if (is_array($element['#value'])) {
        foreach ($element['#value'] as $index => $item) {
            unset($element['#value'][$index]);
            $element['#value'][filter_xss($index)] = filter_xss($item);
        }
    } else {
        if (is_string($element['#value'])) {
            $element['#value'] = filter_xss($element['#value']);
        }
    }
    // Go through each filter option and build the appropriate link or plain text
    foreach ($element['#options'] as $option => $elem) {
        // Check for Taxonomy-based filters
        if (is_object($elem)) {
            $slice = array_slice($elem->option, 0, 1, TRUE);
            list($option, $elem) = each($slice);
        }
        /*
         * Check for optgroups.  Put subelements in the $element_set array and add a group heading.
         * Otherwise, just add the element to the set
         */
        $element_set = array();
        if (is_array($elem)) {
            $element_set = $elem;
        } else {
            $element_set[$option] = $elem;
        }
        $links = array();
        $multiple = !empty($element['#multiple']);
        foreach ($element_set as $key => $value) {
            // Custom ID for each link based on the <select>'s original ID
            $id = drupal_html_id($element['#id'] . '-' . $key);
            $elem = array('#id' => $id, '#markup' => '', '#type' => 'bef-link', '#name' => $id);
            if (array_search($key, $selected_options) === FALSE) {
                if ($_GET['q'] === 'logo-file') {
                    $elem['#children'] = l($value, 'logo-file/taxonomy', array('query' => array($name => $key)));
                } elseif ($_GET['q'] === 'medium') {
                    $elem['#children'] = l($value, 'medium/taxonomy', array('query' => array($name => $key)));
                } else {
                    $elem['#children'] = l($value, bef_replace_query_string_arg($name, $key, $multiple));
                }
                $output .= theme('form_element', array('element' => $elem));
            } else {
                $elem['#children'] = l($value, bef_replace_query_string_arg($name, $key, $multiple, true));
                _form_set_class($elem, array('bef-select-as-links-selected'));
                $output .= str_replace('form-item', 'form-item selected', theme('form_element', array('element' => $elem)));
            }
        }
    }
    $properties = array('#description' => isset($element['#bef_description']) ? $element['#bef_description'] : '', '#children' => $output);
    $output = '<div class="bef-select-as-links">';
    $output .= theme('form_element', array('element' => $properties));
    if (!empty($element['#value'])) {
        if (is_array($element['#value'])) {
            foreach ($element['#value'] as $value) {
                $output .= '<input type="hidden" name="' . $name . '[]" value="' . $value . '" />';
            }
        } else {
            $output .= '<input type="hidden" name="' . $name . '" value="' . $element['#value'] . '" />';
        }
    }
    $output .= '</div>';
    return $output;
}
/**
 * Override of theme_file().
 * Reduces the size of upload fields which are by default far too long.
 */
function tao_file($element)
{
    _form_set_class($element, array('form-file'));
    $attr = $element['#attributes'] ? ' ' . drupal_attributes($element['#attributes']) : '';
    return theme('form_element', $element, "<input type='file' name='{$element['#name']}' id='{$element['#id']}' size='15' {$attr} />");
}
Exemple #24
0
/**
 * Implements hook_textarea().
 *
 * Remove grippie from textarea.
 */
function loop_textarea($variables)
{
    $element = $variables['element'];
    $element['#attributes']['name'] = $element['#name'];
    $element['#attributes']['id'] = $element['#id'];
    $element['#attributes']['cols'] = $element['#cols'];
    $element['#attributes']['rows'] = $element['#rows'];
    _form_set_class($element, array('form-textarea'));
    $wrapper_attributes = array('class' => array('form-textarea-wrapper'));
    $output = '<div' . drupal_attributes($wrapper_attributes) . '>';
    $output .= '<textarea' . drupal_attributes($element['#attributes']) . '>' . check_plain($element['#value']) . '</textarea>';
    $output .= '</div>';
    return $output;
}
Exemple #25
0
/**
 * Override of theme('textarea').
 * Deprecate misc/textarea.js in favor of using the 'resize' CSS3 property.
 */
function md_thenews_textarea($variables)
{
    $element = $variables['element'];
    $element['#attributes']['name'] = $element['#name'];
    $element['#attributes']['id'] = $element['#id'];
    $element['#attributes']['cols'] = $element['#cols'];
    $element['#attributes']['rows'] = $element['#rows'];
    _form_set_class($element, array('form-textarea'));
    $wrapper_attributes = array('class' => array('form-textarea-wrapper'));
    // Add resizable behavior.
    if (!empty($element['#resizable'])) {
        if (!theme_get_setting('css3_textarea')) {
            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;
}
Exemple #26
0
function neb_urlfield($variables)
{
    $element = $variables['element'];
    $element['#attributes']['type'] = 'url';
    element_set_attributes($element, array('id', 'name', 'value', 'size', 'maxlength', 'placeholder'));
    _form_set_class($element, array('form-text', 'form-url'));
    //is this element requred then lest add the required element into the input
    $required = !empty($element['#required']) ? ' required' : '';
    $extra = elements_add_autocomplete($element);
    $output = '<input' . drupal_attributes($element['#attributes']) . $required . ' />';
    return $output . $extra;
}
Exemple #27
0
/**
 * Overrides theme_fieldset().
 *
 * Add another div wrapper around fieldsets for styling purposes.
 */
function commons_beehive_fieldset($variables)
{
    $element = $variables['element'];
    element_set_attributes($element, array('id'));
    _form_set_class($element, array('form-wrapper'));
    $output = '<fieldset' . drupal_attributes($element['#attributes']) . '>';
    if (!empty($element['#title'])) {
        // Always wrap fieldset legends in a SPAN for CSS positioning.
        $output .= '<legend><span class="fieldset-legend">' . $element['#title'] . '</span></legend>';
    }
    $output .= '<div class="fieldset-wrapper">';
    if (!empty($element['#description'])) {
        $output .= '<div class="fieldset-description">' . $element['#description'] . '</div>';
    }
    $output .= $element['#children'];
    if (isset($element['#value'])) {
        $output .= $element['#value'];
    }
    $output .= '</div>';
    $output .= "</fieldset>\n";
    return '<div class="fieldset-outer-wrapper">' . $output . '</div>';
}
Exemple #28
0
/**
 * Returns HTML for a fieldset form element and its children.
 *
 * @param $variables
 *   An associative array containing:
 *   - element: An associative array containing the properties of the element.
 *     Properties used: #attributes, #children, #collapsed, #collapsible,
 *     #description, #id, #title, #value.
 *
 * @ingroup themeable
 */
function corolla_fieldset($vars)
{
    $element = $vars['element'];
    element_set_attributes($element, array('id'));
    _form_set_class($element, array('form-wrapper'));
    $fieldset_wrapper_class = '';
    $output = '<fieldset' . drupal_attributes($element['#attributes']) . '>';
    if (!empty($element['#title'])) {
        // Always wrap fieldset legends in a SPAN for CSS positioning.
        $output .= '<legend><span class="fieldset-legend">' . $element['#title'] . '</span></legend>';
        // add a class if a legend is being included
        $fieldset_wrapper_class = ' with-legend';
    }
    $output .= '<div class="fieldset-wrapper' . $fieldset_wrapper_class . '">';
    if (!empty($element['#description'])) {
        $output .= '<div class="fieldset-description">' . $element['#description'] . '</div>';
    }
    $output .= $element['#children'];
    if (isset($element['#value'])) {
        $output .= $element['#value'];
    }
    $output .= '</div>';
    $output .= "</fieldset>\n";
    return $output;
}
/**
 * Returns HTML for a fieldset.
 */
function at_commerce_fieldset($vars)
{
    $element = $vars['element'];
    element_set_attributes($element, array('id'));
    _form_set_class($element, array('form-wrapper'));
    $output = '<fieldset' . drupal_attributes($element['#attributes']) . '>';
    // add a class to the fieldset wrapper if a legend exists, in some instances they do not
    $class = "without-legend";
    if (!empty($element['#title'])) {
        // Always wrap fieldset legends in a SPAN for CSS positioning.
        $output .= '<legend><span class="fieldset-legend">' . $element['#title'] . '</span></legend>';
        // Add a class to the fieldset wrapper if a legend exists, in some instances they do not
        $class = 'with-legend';
    }
    $output .= '<div class="fieldset-wrapper ' . $class . '">';
    if (!empty($element['#description'])) {
        $output .= '<div class="fieldset-description">' . $element['#description'] . '</div>';
    }
    $output .= $element['#children'];
    if (isset($element['#value'])) {
        $output .= $element['#value'];
    }
    $output .= '</div>';
    $output .= "</fieldset>\n";
    return $output;
}
<?php

$element = $variables['element'];
$element['#attributes']['type'] = 'checkbox';
element_set_attributes($element, array('id', 'name', '#return_value' => 'value'));
// Unchecked checkbox has #value of integer 0.
if (!empty($element['#checked'])) {
    $element['#attributes']['checked'] = 'checked';
}
_form_set_class($element, array('form-checkbox'));
print '<input' . drupal_attributes($element['#attributes']) . ' />';