当前位置: 首页>>代码示例>>PHP>>正文


PHP FormField::add_desc方法代码示例

本文整理汇总了PHP中FormField::add_desc方法的典型用法代码示例。如果您正苦于以下问题:PHP FormField::add_desc方法的具体用法?PHP FormField::add_desc怎么用?PHP FormField::add_desc使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在FormField的用法示例。


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

示例1: _render

 /**
  * The actual rendering.
  *
  * @param array $args
  *
  * @return string
  */
 protected function _render($args)
 {
     $args = wp_parse_args($args, array('value' => '', 'desc_pos' => 'after', 'extra' => array('class' => 'regular-text')));
     $values = maybe_unserialize($args['value']);
     $opts = '<div class="ae_gallery_field" id="' . uniqid() . '">';
     $opts .= '<script class="data-args">' . wp_json_encode($args) . '</script>';
     $opts .= '<script class="data-value">' . wp_json_encode($values) . '</script>';
     $opts .= '</div>';
     return FormField::add_desc($opts, $args['desc'], $args['desc_pos']);
 }
开发者ID:nguyenvanduocit,项目名称:aEngine,代码行数:17,代码来源:GalleryField.php

示例2: _render

 /**
  * Generate the corresponding HTML for a field.
  *
  * @param array $args
  *
  * @return string
  */
 protected function _render($args)
 {
     $args = wp_parse_args($args, array('numeric' => false, 'checked' => null));
     if (!is_array($args['checked'])) {
         $args['checked'] = array();
     }
     $opts = '';
     foreach ($args['choices'] as $value => $title) {
         $single_input = FormField::_checkbox(array('name' => $args['name'] . '[]', 'type' => 'checkbox', 'value' => $value, 'checked' => in_array($value, $args['checked']), 'desc' => $title, 'desc_pos' => 'after'));
         $opts .= str_replace(FormBuilder::TOKEN, $single_input, $args['wrap_each']);
     }
     return FormField::add_desc($opts, $args['desc'], $args['desc_pos']);
 }
开发者ID:nguyenvanduocit,项目名称:aEngine,代码行数:20,代码来源:MultipleChoiceField.php

示例3: _render_specific

 /**
  * Generate the corresponding HTML for a field.
  *
  * @param array $args
  *
  * @return string
  */
 protected function _render_specific($args)
 {
     if (array('foo') === $args['selected']) {
         // radio buttons should always have one option selected
         $args['selected'] = key($args['choices']);
     }
     $opts = '';
     foreach ($args['choices'] as $value => $title) {
         $value = (string) $value;
         $single_input = FormField::_checkbox(array('name' => $args['name'], 'type' => 'radio', 'value' => $value, 'checked' => $value == $args['selected'], 'desc' => $title, 'desc_pos' => 'after'));
         $opts .= str_replace(FormBuilder::TOKEN, $single_input, $args['wrap_each']);
     }
     return FormField::add_desc($opts, $args['desc'], $args['desc_pos']);
 }
开发者ID:nguyenvanduocit,项目名称:aEngine,代码行数:21,代码来源:RadiosField.php

示例4: _render

 /**
  * The actual rendering.
  *
  * @param array $args
  */
 protected function _render($args)
 {
     $args = wp_parse_args($args, array('value' => '', 'desc_pos' => 'after', 'extra' => array('class' => 'regular-text')));
     $values = maybe_unserialize($args['value']);
     $opts = '';
     foreach ($values as $index => $group) {
         $group_id = 'group_' . $index;
         $opts .= '<div id="' . $group_id . '">';
         if (is_array($group)) {
             foreach ($group as $key => $value) {
                 $single_input = FormField::_input_gen(array('name' => $args['name'] . '[' . $index . '][' . $key . ']', 'type' => 'text', 'value' => $value, 'desc' => $key, 'desc_pos' => 'before'));
                 $opts .= '<br>' . str_replace(FormBuilder::TOKEN, $single_input, $args['wrap_each']);
             }
             $opts .= '<button class="btnRemoveRule" data-id="' . $group_id . '">Remove</button></div>';
         }
     }
     $opts .= '<button class="btnAddRule" data-count="' . count($values) . '">Add</button>';
     return FormField::add_desc($opts, $args['desc'], $args['desc_pos']);
 }
开发者ID:nguyenvanduocit,项目名称:WP-Git-Manager,代码行数:24,代码来源:MultipleTextField.php


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