• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

PHP get_t函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



在下文中一共展示了get_t函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的PHP代码示例。

示例1: webspark_seven_form_required_marker

function webspark_seven_form_required_marker($variables)
{
    // This is also used in the installer, pre-database setup.
    $t = get_t();
    $attributes = array('class' => 'form-required', 'title' => $t('This field is required.'));
    return '<span' . drupal_attributes($attributes) . '> * </span>';
}
开发者ID:sourfacedcyclop,项目名称:webspark-drops-drupal7,代码行数:7,代码来源:template.php


示例2: marco_form_element

/**
 * Return a themed form element.
 * Edited to remove colon.
 *
 * @param element
 *   An associative array containing the properties of the element.
 *   Properties used: title, description, id, required
 * @param $value
 *   The form element's data.
 * @return
 *   A string representing the form element.
 *
 * @ingroup themeable
 */
function marco_form_element($element, $value)
{
    // This is also used in the installer, pre-database setup.
    $t = get_t();
    $output = '<div class="form-item"';
    if (!empty($element['#id'])) {
        $output .= ' id="' . $element['#id'] . '-wrapper"';
    }
    $output .= ">\n";
    $required = !empty($element['#required']) ? '<span class="form-required" title="' . $t('This field is required.') . '"></span>' : '';
    if (!empty($element['#title'])) {
        $title = $element['#title'];
        if (!empty($element['#id'])) {
            $output .= ' <label for="' . $element['#id'] . '">' . $t('!title !required', array('!title' => filter_xss_admin($title), '!required' => $required)) . "</label>\n";
        } else {
            $output .= ' <label>' . $t('!title !required', array('!title' => filter_xss_admin($title), '!required' => $required)) . "</label>\n";
        }
    }
    $output .= " {$value}\n";
    if (!empty($element['#description'])) {
        $output .= ' <div class="description">' . $element['#description'] . "</div>\n";
    }
    $output .= "</div>\n";
    return $output;
}
开发者ID:rocafuerte,项目名称:marco,代码行数:39,代码来源:template.php


示例3: mothership_form_element

/**
 * @file
 * form mothership overwrites
 */
function mothership_form_element($element, $value)
{
    // This is also used in the installer, pre-database setup.
    $t = get_t();
    //add a more specific form-item-$type
    $output = "<div class=\"form-item form-item-" . $element['#type'] . " \" ";
    // TODO cant this be dublicated on a page?
    //and then its not unique
    if (!empty($element['#id'])) {
        $output .= ' id="' . $element['#id'] . '-wrapper"';
    }
    $output .= ">\n";
    $required = !empty($element['#required']) ? '<span class="form-required" title="' . $t('This field is required.') . '">*</span>' : '';
    if (!empty($element['#title'])) {
        $title = $element['#title'];
        if (!empty($element['#id'])) {
            $output .= ' <label for="' . $element['#id'] . '">' . $t('!title: !required', array('!title' => filter_xss_admin($title), '!required' => $required)) . "</label>\n";
        } else {
            $output .= ' <label>' . $t('!title: !required', array('!title' => filter_xss_admin($title), '!required' => $required)) . "</label>\n";
        }
    }
    //TODO test to see if this is clean text - then we might need a <span>
    //if we need to catch the content with
    $output .= "{$value}\n";
    if (!empty($element['#description'])) {
        $output .= '<div class="form-description">' . $element['#description'] . "</div>\n";
    }
    $output .= "</div>\n";
    return $output;
}
开发者ID:victoriachan,项目名称:victoriac-blog,代码行数:34,代码来源:template.form.php


示例4: mothership_form_element

function mothership_form_element($element, $value)
{
    // This is also used in the installer, pre-database setup.
    $t = get_t();
    //$output = '<div>';
    //  removed $output = '<div class="form-item"';
    //so we dont know its a div hmm? form>div ....
    $output = '<div ';
    // removed the ID wrapper?
    if (!empty($element['#id'])) {
        $output .= ' id="' . $element['#id'] . '-wrapper"';
    }
    $output .= ">\n";
    $required = !empty($element['#required']) ? '<span class="form-required" title="' . $t('This field is required.') . '">*</span>' : '';
    if (!empty($element['#title'])) {
        $title = $element['#title'];
        if (!empty($element['#id'])) {
            $output .= ' <label for="' . $element['#id'] . '">' . $t('!title: !required', array('!title' => filter_xss_admin($title), '!required' => $required)) . "</label>\n";
        } else {
            $output .= ' <label>' . $t('!title: !required', array('!title' => filter_xss_admin($title), '!required' => $required)) . "</label>\n";
        }
    }
    //TODO test to see if this is clean text - then we might need a <span> etc
    $output .= "{$value}\n";
    if (!empty($element['#description'])) {
        $output .= '<div class="description">' . $element['#description'] . "</div>\n";
    }
    $output .= "</div>\n";
    return $output;
}
开发者ID:Joanl,项目名称:ding,代码行数:30,代码来源:template.form.php


示例5: tibco_styles_form_element_label

/**
 * Implements theme_form_element_label().
 */
function tibco_styles_form_element_label($variables)
{
    $element = $variables['element'];
    // This is also used in the installer, pre-database setup.
    $t = get_t();
    // If title and required marker are both empty, output no label.
    if ((!isset($element['#title']) || $element['#title'] === '') && empty($element['#required'])) {
        return '';
    }
    // If the element is required, a required marker is appended to the label.
    $required = !empty($element['#required']) ? theme('form_required_marker', array('element' => $element)) : '';
    $title = filter_xss_admin($element['#title']);
    $attributes = array();
    // Style the label as class option to display inline with the element.
    if ($element['#title_display'] == 'after') {
        $attributes['class'] = 'option';
    } elseif ($element['#title_display'] == 'invisible') {
        $attributes['class'] = 'element-invisible';
    }
    if (!empty($element['#id'])) {
        $attributes['for'] = $element['#id'];
    }
    $help = '';
    if ($element['#type'] == 'checkbox' && $element['#entity_type'] == 'entityform') {
        $help = $element['#checkbox_suffix'];
    }
    // The leading whitespace helps visually separate fields from inline labels.
    return ' <label' . drupal_attributes($attributes) . '>' . $t('!title !required', array('!title' => $title, '!required' => $required)) . $help . "</label>\n";
}
开发者ID:JaspersoftMarketing,项目名称:design_guide,代码行数:32,代码来源:template.php


示例6: europa_form_required_marker

/**
 * Overrides theme_form_required_marker().
 */
function europa_form_required_marker($variables)
{
    // This is also used in the installer, pre-database setup.
    $t = get_t();
    $attributes = array('class' => 'form-required text-danger glyphicon glyphicon-asterisk', 'title' => $t('This field is required.'));
    return '<span' . drupal_attributes($attributes) . '></span>';
}
开发者ID:janoka,项目名称:platform-dev,代码行数:10,代码来源:template.php


示例7: hook_requirements

/**
 * Check installation requirements and do status reporting.
 *
 * This hook has two closely related uses, determined by the $phase argument:
 * checking installation requirements ($phase == 'install')
 * and status reporting ($phase == 'runtime').
 *
 * Note that this hook, like all others dealing with installation and updates,
 * must reside in a module_name.install file, or it will not properly abort
 * the installation of the module if a critical requirement is missing.
 *
 * During the 'install' phase, modules can for example assert that
 * library or server versions are available or sufficient.
 * Note that the installation of a module can happen during installation of
 * Drupal itself (by install.php) with an installation profile or later by hand.
 * As a consequence, install-time requirements must be checked without access
 * to the full Drupal API, because it is not available during install.php.
 * For localisation you should for example use $t = get_t() to
 * retrieve the appropriate localisation function name (t() or st()).
 * If a requirement has a severity of REQUIREMENT_ERROR, install.php will abort
 * or at least the module will not install.
 * Other severity levels have no effect on the installation.
 * Module dependencies do not belong to these installation requirements,
 * but should be defined in the module's .info file.
 *
 * The 'runtime' phase is not limited to pure installation requirements
 * but can also be used for more general status information like maintenance
 * tasks and security issues.
 * The returned 'requirements' will be listed on the status report in the
 * administration section, with indication of the severity level.
 * Moreover, any requirement with a severity of REQUIREMENT_ERROR severity will
 * result in a notice on the the administration overview page.
 *
 * @param $phase
 *   The phase in which hook_requirements is run:
 *   - 'install': the module is being installed.
 *   - 'runtime': the runtime requirements are being checked and shown on the
 *              status report page.
 *
 * @return
 *   A keyed array of requirements. Each requirement is itself an array with
 *   the following items:
 *     - 'title': the name of the requirement.
 *     - 'value': the current value (e.g. version, time, level, ...). During
 *       install phase, this should only be used for version numbers, do not set
 *       it if not applicable.
 *     - 'description': description of the requirement/status.
 *     - 'severity': the requirement's result/severity level, one of:
 *         - REQUIREMENT_INFO:    For info only.
 *         - REQUIREMENT_OK:      The requirement is satisfied.
 *         - REQUIREMENT_WARNING: The requirement failed with a warning.
 *         - REQUIREMENT_ERROR:   The requirement failed with an error.
 */
function hook_requirements($phase)
{
    $requirements = array();
    // Ensure translations don't break at install time
    $t = get_t();
    // Report Drupal version
    if ($phase == 'runtime') {
        $requirements['drupal'] = array('title' => $t('Drupal'), 'value' => VERSION, 'severity' => REQUIREMENT_INFO);
    }
    // Test PHP version
    $requirements['php'] = array('title' => $t('PHP'), 'value' => $phase == 'runtime' ? l(phpversion(), 'admin/logs/status/php') : phpversion());
    if (version_compare(phpversion(), DRUPAL_MINIMUM_PHP) < 0) {
        $requirements['php']['description'] = $t('Your PHP installation is too old. Drupal requires at least PHP %version.', array('%version' => DRUPAL_MINIMUM_PHP));
        $requirements['php']['severity'] = REQUIREMENT_ERROR;
    }
    // Report cron status
    if ($phase == 'runtime') {
        $cron_last = variable_get('cron_last', NULL);
        if (is_numeric($cron_last)) {
            $requirements['cron']['value'] = $t('Last run !time ago', array('!time' => format_interval(time() - $cron_last)));
        } else {
            $requirements['cron'] = array('description' => $t('Cron has not run. It appears cron jobs have not been setup on your system. Please check the help pages for <a href="@url">configuring cron jobs</a>.', array('@url' => 'http://drupal.org/cron')), 'severity' => REQUIREMENT_ERROR, 'value' => $t('Never run'));
        }
        $requirements['cron']['description'] .= ' ' . t('You can <a href="@cron">run cron manually</a>.', array('@cron' => url('admin/logs/status/run-cron')));
        $requirements['cron']['title'] = $t('Cron maintenance tasks');
    }
    return $requirements;
}
开发者ID:t-web,项目名称:drupal-doxygen-base,代码行数:81,代码来源:install.php


示例8: bootstrap_psdpt_form_element_label

/**
 * Overrides theme_form_element_label().
 */
function bootstrap_psdpt_form_element_label(&$variables)
{
    $element = $variables['element'];
    // This is also used in the installer, pre-database setup.
    $t = get_t();
    // Determine if certain things should skip for checkbox or radio elements.
    $skip = isset($element['#type']) && ('checkbox' === $element['#type'] || 'radio' === $element['#type']);
    // If title and required marker are both empty, output no label.
    if ((!isset($element['#title']) || $element['#title'] === '' && !$skip) && empty($element['#required'])) {
        return '';
    }
    // If the element is required, a required marker is appended to the label.
    $required = !empty($element['#required']) ? theme('form_required_marker', array('element' => $element)) : '';
    $title = filter_xss_admin($element['#title']);
    $attributes = array();
    // Style the label as class option to display inline with the element.
    if ($element['#title_display'] == 'after' && !$skip) {
        $attributes['class'][] = $element['#type'];
    } elseif ($element['#title_display'] == 'invisible') {
        $attributes['class'][] = 'element-invisible';
    }
    if (!empty($element['#id'])) {
        $attributes['for'] = $element['#id'];
    }
    // Insert radio and checkboxes inside label elements.
    $output = '';
    if (isset($variables['#children'])) {
        $output .= $variables['#children'];
    }
    // Append label.
    $output .= $t('!title !required', array('!title' => $title, '!required' => $required));
    // The leading whitespace helps visually separate fields from inline labels.
    return ' <label' . drupal_attributes($attributes) . '>' . $output . "</label>\n";
}
开发者ID:atssc-scdata,项目名称:bootstrap_psdpt,代码行数:37,代码来源:form-element-label.func.php


示例9: __construct

 public function __construct()
 {
     // Beeptify values
     $this->id = 'beeptify';
     $this->method_title = 'Beeptify';
     $this->icon = WP_PLUGIN_URL . "/" . plugin_basename(dirname(__FILE__)) . '/images/logo.png';
     $this->has_fields = false;
     $this->liveurl = 'https://my.beeptify.com/payment?registered=False';
     // Load the form fields
     $this->init_form_fields();
     // Load the settings.
     $this->init_settings();
     // Define user set variables
     $this->title = $this->settings['title'];
     $this->description = $this->settings['description'];
     $this->merchant_id = $this->settings['merchant_id'];
     $this->pay_language = $this->settings['pay_language'];
     $this->mode = $this->settings['mode'];
     $this->frame = $this->settings['frame'];
     $this->secret = $this->settings['secret'];
     $this->testmode = $this->settings['testmode'];
     if (empty($this->pay_language)) {
         $this->pay_language = 'en-GB.php';
     }
     // Translations
     require_once 'lang/' . $this->pay_language . '.php';
     $this->_t = get_t();
     // Order btn text
     $this->order_button_text = $this->_t['pay_beeptify'];
     // Test mode values
     if ($this->yesnotoint($this->testmode)) {
         $this->liveurl = 'https://stage.beeptify.com/payment';
     }
     // Logs
     $this->log = new WC_Logger();
     // Actions
     // Add check for callback
     add_action('init', array(&$this, 'check_callback'));
     // Check for successful callback
     add_action('valid_beeptify_callback', array(&$this, 'successful_request'));
     add_action('woocommerce_api_wc_payment_gateway_beeptify', array($this, 'check_callback'));
     // Add our admin options
     add_action('woocommerce_update_options_payment_gateways', array(&$this, 'process_admin_options'));
     add_action('woocommerce_update_options_payment_gateways_' . $this->id, array($this, 'process_admin_options'));
     // Hook in to reciept
     add_action('woocommerce_receipt_beeptify', array($this, 'receipt'));
     // Hook in to thank you
     add_action('woocommerce_thankyou_beeptify', array($this, 'thankyou'));
     // Test if costumer can use plugin, eg lang
     if (!$this->is_valid_for_use()) {
         $this->enabled = false;
     }
 }
开发者ID:Ivan0905,项目名称:beeptify-payment-module-woocommerce,代码行数:53,代码来源:gateway.beeptify.php


示例10: ding_wayf_dk_login_requirements

/**
 * Implements hook_requirements().
 */
function ding_wayf_dk_login_requirements($phase)
{
    $requirements = array();
    // Ensure translations don't break at install time.
    $t = get_t();
    if ($phase == 'runtime') {
        if (!variable_get('wayf_hash', FALSE)) {
            $requirements['wayf_hash'] = array('value' => $t('WAYF not configured correctly'), 'description' => $t('WAYF is not properly configured, you need to set $conf[\'wayf_hash\'] in setttings.php.'), 'severity' => REQUIREMENT_ERROR);
        }
    }
    return $requirements;
}
开发者ID:vejlebib,项目名称:ding_wayf_dk,代码行数:15,代码来源:ding_wayf_dk_login.install.php


示例11: form_fun_form_element

/**
 * Overriding theme_form_element().
 */
function form_fun_form_element($element, $value)
{
    // This is also used in the installer, pre-database setup.
    $t = get_t();
    $attributes = array();
    // Add drupal defaults
    if (!empty($element['#id'])) {
        $attributes['id'] = $element['#id'] . '-wrapper';
    }
    $attributes['class'][] = 'form-item';
    // Add a class indicating if a label isn't inside this element.
    // (Not sure if I'm keeping this or not)
    if (empty($element['#title'])) {
        $attributes['class'][] = 'form-item-no-label';
    }
    // Add a clearfix classes on most elements, might add some more here.
    $inline = array('radio', 'checkbox');
    if (!in_array($element['#type'], $inline)) {
        $attributes['class'][] = 'clearfix';
    }
    // Flatten the attributes for output.
    $attributes = theme('render_attributes', $attributes);
    // Form required marker
    $required = !empty($element['#required']) ? '<span class="form-required" title="' . $t('This field is required.') . '">*</span>' : '';
    // Label
    if (!empty($element['#title'])) {
        $title = $element['#title'];
        if (!empty($element['#id'])) {
            $label = '<label for="' . $element['#id'] . '">' . $t('!title !required', array('!title' => filter_xss_admin($title), '!required' => $required)) . '</label>' . "\n";
        } else {
            $label = '<label>' . $t('!title !required', array('!title' => filter_xss_admin($title), '!required' => $required)) . '</label>' . "\n";
        }
    }
    // Description
    if (!empty($element['#description'])) {
        $description = '<div class="description">' . $element['#description'] . '</div>' . "\n";
    }
    // Prepare the output
    $output = "\n" . '<div' . $attributes . '>' . "\n";
    // If there is no label, we can have less markup.  Wrapper level class can handle positioning.
    if (!$label) {
        $output .= '<div class="inner">' . "\n" . $value . "\n" . $description . '</div>';
    } else {
        $output .= $label . '<div class="right">' . "\n" . '<div class="inner">' . "\n" . $value . "\n" . $description . '</div>' . "\n" . '</div>' . "\n";
    }
    $output .= '</div>' . "\n";
    return $output;
}
开发者ID:jacine,项目名称:form-fun,代码行数:51,代码来源:template.php


示例12: tao_form_element

/**
 * Override of theme_form_element().
 * Take a more sensitive/delineative approach toward theming form elements.
 */
function tao_form_element($element, $value)
{
    $output = '';
    // This is also used in the installer, pre-database setup.
    $t = get_t();
    // Add a wrapper id
    $attr = array('class' => '');
    $attr['id'] = !empty($element['#id']) ? "{$element['#id']}-wrapper" : NULL;
    // Type logic
    $label_attr = array();
    $label_attr['for'] = !empty($element['#id']) ? $element['#id'] : '';
    if (!empty($element['#type']) && in_array($element['#type'], array('checkbox', 'radio'))) {
        $label_type = 'label';
        $attr['class'] .= ' form-item form-option';
    } else {
        $label_type = 'label';
        $attr['class'] .= ' form-item';
    }
    // Generate required markup
    $required_title = $t('This field is required.');
    $required = !empty($element['#required']) ? "<span class='form-required' title='{$required_title}'>*</span>" : '';
    // Generate label markup
    if (!empty($element['#title'])) {
        $title = $t('!title: !required', array('!title' => filter_xss_admin($element['#title']), '!required' => $required));
        $label_attr = drupal_attributes($label_attr);
        $output .= "<{$label_type} {$label_attr}>{$title}</{$label_type}>";
        $attr['class'] .= ' form-item-labeled';
    }
    // Add child values
    $output .= "{$value}";
    // Description markup
    $output .= !empty($element['#description']) ? "<div class='description'>{$element['#description']}</div>" : '';
    // Render the whole thing
    $attr = drupal_attributes($attr);
    $output = "<div {$attr}>{$output}</div>";
    return $output;
}
开发者ID:rmontero,项目名称:dla_ecommerce_site,代码行数:41,代码来源:template.php


示例13: townsquare_bootstrap_form_element

function townsquare_bootstrap_form_element($variables)
{
    $element =& $variables['element'];
    // This is also used in the installer, pre-database setup.
    $t = get_t();
    // This function is invoked as theme wrapper, but the rendered form element
    // may not necessarily have been processed by form_builder().
    $element += array('#title_display' => 'before');
    // Add element #id for #type 'item'.
    if (isset($element['#markup']) && !empty($element['#id'])) {
        $attributes['id'] = $element['#id'];
    }
    // Add element's #type and #name as class to aid with JS/CSS selectors.
    $attributes['class'] = array('form-item');
    if (!empty($element['#type'])) {
        $attributes['class'][] = 'form-type-' . strtr($element['#type'], '_', '-');
    }
    if (!empty($element['#name'])) {
        $attributes['class'][] = 'form-item-' . strtr($element['#name'], array(' ' => '-', '_' => '-', '[' => '-', ']' => ''));
    }
    // Add a class for disabled elements to facilitate cross-browser styling.
    if (!empty($element['#attributes']['disabled'])) {
        $attributes['class'][] = 'form-disabled';
    }
    $attributes['class'][] = 'control-group';
    $output = '<div' . drupal_attributes($attributes) . '>' . "\n";
    // If #title is not set, we don't display any label or required marker.
    if (!isset($element['#title'])) {
        $element['#title_display'] = 'none';
    }
    $prefix = '<div class="controls">';
    $prefix .= isset($element['#field_prefix']) ? '<span class="field-prefix">' . $element['#field_prefix'] . '</span> ' : '';
    $suffix = isset($element['#field_suffix']) ? ' <span class="field-suffix">' . $element['#field_suffix'] . '</span>' : '';
    $suffix .= '</div>';
    switch ($element['#title_display']) {
        case 'before':
        case 'invisible':
            $output .= ' ' . theme('form_element_label', $variables);
            $output .= ' ' . $prefix . $element['#children'] . $suffix . "\n";
            break;
        case 'after':
            $output .= ' ' . $prefix . $element['#children'] . $suffix;
            $output .= ' ' . theme('form_element_label', $variables) . "\n";
            break;
        case 'none':
        case 'attribute':
            // Output no label and no required marker, only the children.
            $output .= ' ' . $prefix . $element['#children'] . $suffix . "\n";
            break;
    }
    $output .= "</div>\n";
    return $output;
}
开发者ID:nningego,项目名称:townsquare,代码行数:53,代码来源:template.php


示例14: teamwork_15_subtheme_form_element_label

/**
 * Overrides theme_form_element_label().
 */
function teamwork_15_subtheme_form_element_label(&$variables)
{
    $element = $variables['element'];
    $title = filter_xss_admin($element['#title']);
    // If the element is required, a required marker is appended to the label.
    $required = !empty($element['#required']) ? theme('form_required_marker', array('element' => $element)) : '';
    //   // This is also used in the installer, pre-database setup.
    $t = get_t();
    $attributes = array();
    if (!empty($element['#id'])) {
        $attributes['for'] = $element['#id'];
    }
    $output = '';
    if (isset($variables['#children'])) {
        if ($element['#type'] === "radio") {
            $output .= $variables['#children'];
        }
        if ($element['#type'] === "checkbox") {
            $output .= $variables['#children'];
        }
    }
    return ' <label' . backdrop_attributes($attributes) . '></label><div>' . $t('!title', array('!title' => $title)) . "</div> \n";
}
开发者ID:backdrop-contrib,项目名称:teamwork_15,代码行数:26,代码来源:template.php


示例15: mothership_checkbox

function mothership_checkbox($variables)
{
    $element = $variables['element'];
    $t = get_t();
    $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';
    }
    if (!theme_get_setting('mothership_classes_form_input')) {
        _form_set_class($element, array('form-checkbox'));
    }
    return '<input' . drupal_attributes($element['#attributes']) . ' />';
}
开发者ID:kieranbutler,项目名称:ikieran,代码行数:15,代码来源:form.php


示例16: bht_theme_form_element_label

/**
 * Overwrite theme_form_element_label().
 */
function bht_theme_form_element_label($variables)
{
    $element = $variables['element'];
    // This is also used in the installer, pre-database setup.
    $t = get_t();
    // If title and required marker are both empty, output no label.
    if ((!isset($element['#title']) || $element['#title'] === '') && empty($element['#required'])) {
        return '';
    }
    $attributes = array();
    // If the element is required, add a required class.
    if (!empty($element['#required'])) {
        $attributes['class'][] = 'required';
    }
    // If it's invisble, add class.
    if ($element['#title_display'] == 'invisible') {
        $attributes['class'] = 'element-invisible';
    }
    $title = filter_xss_admin($element['#title']);
    if (!empty($element['#id'])) {
        $attributes['for'] = $element['#id'];
    }
    // The leading whitespace helps visually separate fields from inline labels.
    return ' <label' . drupal_attributes($attributes) . '>' . $t('!title', array('!title' => $title)) . "</label>\n";
}
开发者ID:TBeeckmans,项目名称:bht,代码行数:28,代码来源:template.php


示例17: opcaim_form_element_label

function opcaim_form_element_label($variables) {
    $element = $variables ['element'];

    // This is also used in the installer, pre-database setup.
    $t = get_t();

    // If title and required marker are both empty, output no label.
    if ((!isset($element ['#title']) || $element ['#title'] === '') && empty($element ['#required'])) {
        return '';
    }

    // If the element is required, a required marker is appended to the label.
    $required = !empty($element ['#required']) ? theme('form_required_marker', array('element' => $element)) : '';

    $title = filter_xss_admin($element ['#title']);

    $attributes = array();
    // Style the label as class option to display inline with the element.
    if ($element ['#title_display'] == 'after') {
        $attributes ['class'] = 'option';
    }
    // Show label only to screen readers to avoid disruption in visual flows.
    elseif ($element ['#title_display'] == 'invisible') {
        $attributes ['class'] = 'element-invisible';
    }

    if (!empty($element ['#id'])) {
        $attributes ['for'] = $element ['#id'];
    }

    // Ajout d'un trim dans les balises label
    // The leading whitespace helps visually separate fields from inline labels.
    return ' <label' . drupal_attributes($attributes) . '>' . trim($t('!title !required', array('!title' => $title, '!required' => $required))) . "</label>\n";
}
开发者ID:HamzaBendidane,项目名称:prel,代码行数:34,代码来源:template.php


示例18: phptemplate_form_element

function phptemplate_form_element($element, $value)
{
    if (empty($element['#comments_element'])) {
        return theme_form_element($element, $value);
    } else {
        $t = get_t();
        $output = '<div class="form-item container-inline comments-element"';
        if (!empty($element['#id'])) {
            $output .= ' id="' . $element['#id'] . '-wrapper"';
        }
        $output .= ">\n";
        $output .= " {$value}\n";
        $required = !empty($element['#required']) ? '<span class="form-required" title="' . $t('This field is required.') . '">(' . $t('required') . ')</span>' : '';
        if (!empty($element['#title'])) {
            $title = $element['#title'];
            if (!empty($element['#id'])) {
                $output .= ' <label for="' . $element['#id'] . '"><small>' . $t('!title !required', array('!title' => filter_xss_admin($title), '!required' => $required)) . "</small></label>\n";
            } else {
                $output .= ' <label><small>' . $t('!title !required', array('!title' => filter_xss_admin($title), '!required' => $required)) . "</small></label>\n";
            }
        }
        if (!empty($element['#description'])) {
            $output .= ' <div class="description">' . $element['#description'] . "</div>\n";
        }
        $output .= "</div>\n";
        return $output;
    }
}
开发者ID:upei,项目名称:drupal6-cms,代码行数:28,代码来源:template.php


示例19: realia_form_element

function realia_form_element($variables)
{
    $element =& $variables['element'];
    // This function is invoked as theme wrapper, but the rendered form element
    // may not necessarily have been processed by form_builder().
    $element += array('#title_display' => 'before');
    // Add element #id for #type 'item'.
    if (isset($element['#markup']) && !empty($element['#id'])) {
        $attributes['id'] = $element['#id'];
    }
    // Add element's #type and #name as class to aid with JS/CSS selectors.
    $attributes['class'] = array('form-item');
    if (!empty($element['#type'])) {
        $attributes['class'][] = 'form-type-' . strtr($element['#type'], '_', '-');
    }
    if (!empty($element['#name'])) {
        $attributes['class'][] = 'form-item-' . strtr($element['#name'], array(' ' => '-', '_' => '-', '[' => '-', ']' => ''));
    }
    // Add a class for disabled elements to facilitate cross-browser styling.
    if (!empty($element['#attributes']['disabled'])) {
        $attributes['class'][] = 'form-disabled';
    }
    $label = TRUE;
    if ($element['#type'] == 'radio') {
        $styles = realia_aviators_collect_styles();
        if (in_array($element['#array_parents'][0], array_keys($styles))) {
            $label = FALSE;
            if (isset($element['#return_value'])) {
                $attributes['class'][] = str_replace('_', '-', $element['#return_value']);
            }
        }
    }
    if (!$label) {
        $element_output = '<div' . drupal_attributes($attributes) . '>';
    } else {
        $output = '<div' . drupal_attributes($attributes) . '>' . "\n";
    }
    if ($element['#type'] == 'radio') {
        if (!$label) {
            $element = $variables['element'];
            // This is also used in the installer, pre-database setup.
            $t = get_t();
            // If the element is required, a required marker is appended to the label.
            $required = !empty($element['#required']) ? theme('form_required_marker', array('element' => $element)) : '';
            $title = filter_xss_admin($element['#title']);
            $attributes = array();
            // Style the label as class option to display inline with the element.
            if ($element['#title_display'] == 'after') {
                $attributes['class'] = 'option';
            } elseif ($element['#title_display'] == 'invisible') {
                $attributes['class'] = 'element-invisible';
            }
            if (!empty($element['#id'])) {
                $attributes['for'] = $element['#id'];
            }
            // The leading whitespace helps visually separate fields from inline labels.
            $output = $element_output . '<label' . drupal_attributes($attributes) . '>' . $element['#children'] . $t('!title !required', array('!title' => $title, '!required' => $required)) . "</label>";
            if (!empty($element['#description'])) {
                $output .= '<div class="description">' . $element['#description'] . "</div>\n";
            }
            $output .= "</div>\n";
        }
    }
    // If #title is not set, we don't display any label or required marker.
    if (!isset($element['#title'])) {
        $element['#title_display'] = 'none';
    }
    $prefix = isset($element['#field_prefix']) ? '<span class="field-prefix">' . $element['#field_prefix'] . '</span> ' : '';
    $suffix = isset($element['#field_suffix']) ? ' <span class="field-suffix">' . $element['#field_suffix'] . '</span>' : '';
    if ($label) {
        switch ($element['#title_display']) {
            case 'before':
            case 'invisible':
                $output .= ' ' . theme('form_element_label', $variables);
                $output .= ' ' . $prefix . $element['#children'] . $suffix . "\n";
                break;
            case 'after':
                $output .= ' ' . $prefix . $element['#children'] . $suffix;
                $output .= ' ' . theme('form_element_label', $variables) . "\n";
                break;
            case 'none':
            case 'attribute':
                // Output no label and no required marker, only the children.
                $output .= ' ' . $prefix . $element['#children'] . $suffix . "\n";
                break;
        }
    }
    if ($label) {
        if (!empty($element['#description'])) {
            $output .= '<div class="description">' . $element['#description'] . "</div>\n";
        }
        $output .= "</div>\n";
    }
    return $output;
}
开发者ID:agroknow,项目名称:mermix,代码行数:95,代码来源:template.php


示例20: tao_preprocess_form_element

/**
 * Implementation of preprocess_form_element().
 * Take a more sensitive/delineative approach toward theming form elements.
 */
function tao_preprocess_form_element(&$vars)
{
    $element = $vars['element'];
    // Main item attributes.
    $vars['attr'] = array();
    $vars['attr']['class'] = 'form-item';
    $vars['attr']['id'] = !empty($element['#id']) ? "{$element['#id']}-wrapper" : NULL;
    if (!empty($element['#type']) && in_array($element['#type'], array('checkbox', 'radio'))) {
        $vars['attr']['class'] .= ' form-option';
    }
    $vars['description'] = isset($element['#description']) ? $element['#description'] : '';
    // Generate label markup
    if (!empty($element['#title'])) {
        $t = get_t();
        $required_title = $t('This field is required.');
        $required = !empty($element['#required']) ? "<span class='form-required' title='{$required_title}'>*</span>" : '';
        $vars['label_title'] = $t('!title: !required', array('!title' => filter_xss_admin($element['#title']), '!required' => $required));
        $vars['label_attr'] = array();
        if (!empty($element['#id'])) {
            $vars['label_attr']['for'] = $element['#id'];
        }
        // Indicate that this form item is labeled
        $vars['attr']['class'] .= ' form-item-labeled';
    }
}
开发者ID:hampelm,项目名称:Ginsberg-CiviDemo,代码行数:29,代码来源:template.php



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
PHP get_table函数代码示例发布时间:2022-05-15
下一篇:
PHP get_system_context函数代码示例发布时间:2022-05-15
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap