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


PHP RWMB_Field类代码示例

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


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

示例1: start_el

 /**
  * @see Walker::start_el()
  *
  * @param string $output            Passed by reference. Used to append additional content.
  * @param object $object            Item data object.
  * @param int    $depth             Depth of item.
  * @param int    $current_object_id Item ID.
  * @param array  $args
  */
 public function start_el(&$output, $object, $depth = 0, $args = array(), $current_object_id = 0)
 {
     $label = $this->db_fields['label'];
     $id = $this->db_fields['id'];
     $attributes = RWMB_Field::call('get_attributes', $this->field, $object->{$id});
     $output .= sprintf('<li><label><input %s %s>%s</label>', RWMB_Field::render_attributes($attributes), checked(in_array($object->{$id}, $this->meta), 1, false), $object->{$label});
 }
开发者ID:kevin578,项目名称:mrteacherkevin,代码行数:16,代码来源:input-list-walker.php

示例2: start_el

 /**
  * @see Walker::start_el()
  *
  * @param string $output            Passed by reference. Used to append additional content.
  * @param object $object            Item
  * @param int    $depth             Depth of Item.
  * @param int    $current_object_id Item id.
  * @param array  $args
  */
 public function start_el(&$output, $object, $depth = 0, $args = array(), $current_object_id = 0)
 {
     $label = $this->db_fields['label'];
     $id = $this->db_fields['id'];
     $meta = $this->meta;
     $indent = str_repeat('&nbsp;', $depth * 4);
     $output .= sprintf('<option value="%s" %s>%s%s</option>', $object->{$id}, selected(in_array($object->{$id}, $meta), 1, false), $indent, RWMB_Field::filter('choice_label', $object->{$label}, $this->field, $object));
 }
开发者ID:rilwis,项目名称:meta-box,代码行数:17,代码来源:select.php

示例3: start_el

 /**
  * @see Walker::start_el()
  *
  * @param string $output            Passed by reference. Used to append additional content.
  * @param object $object            Item data object.
  * @param int    $depth             Depth of item.
  * @param int    $current_object_id Item ID.
  * @param array  $args
  */
 public function start_el(&$output, $object, $depth = 0, $args = array(), $current_object_id = 0)
 {
     $label = $this->db_fields['label'];
     $id = $this->db_fields['id'];
     $meta = $this->meta;
     $field = $this->field;
     $field_class = RW_Meta_Box::get_class_name($field);
     $attributes = call_user_func(array($field_class, 'get_attributes'), $field, $object->{$id});
     $output .= sprintf('<li><label><input %s %s>%s</label>', RWMB_Field::render_attributes($attributes), checked(in_array($object->{$id}, $meta), 1, false), $object->{$label});
 }
开发者ID:warfare-plugins,项目名称:social-warfare,代码行数:19,代码来源:input-list-walker.php

示例4: enqueue

 /**
  * Enqueue scripts for validation.
  *
  * @param RW_Meta_Box $object Meta Box object
  */
 public function enqueue($object)
 {
     if (empty($object->meta_box['validation'])) {
         return;
     }
     wp_enqueue_script('jquery-validation', RWMB_JS_URL . 'jquery-validation/jquery.validate.min.js', array('jquery'), '1.15.0', true);
     wp_enqueue_script('jquery-validation-additional-methods', RWMB_JS_URL . 'jquery-validation/additional-methods.min.js', array('jquery-validation'), '1.15.0', true);
     wp_enqueue_script('rwmb-validate', RWMB_JS_URL . 'validate.js', array('jquery-validation', 'jquery-validation-additional-methods'), RWMB_VER, true);
     RWMB_Field::localize_script('rwmb-validate', 'rwmbValidate', array('summaryMessage' => esc_html__('Please correct the errors highlighted below and try again.', 'meta-box')));
 }
开发者ID:rilwis,项目名称:meta-box,代码行数:15,代码来源:validation.php

示例5: display_level

 function display_level($options, $parent_id = 0, $active = false)
 {
     $id = $this->db_fields['id'];
     $field = $this->field;
     $walker = new RWMB_Walker_Select($this->db_fields, $field, $this->meta);
     $attributes = RWMB_Field::call('get_attributes', $field, $this->meta);
     $children = $options[$parent_id];
     $output = sprintf('<div class="rwmb-select-tree %s" data-parent-id="%s"><select %s>', $active ? '' : 'hidden', $parent_id, RWMB_Field::render_attributes($attributes));
     $output .= isset($field['placeholder']) ? "<option value=''>{$field['placeholder']}</option>" : '<option></option>';
     $output .= $walker->walk($children, -1);
     $output .= '</select>';
     foreach ($children as $c) {
         if (isset($options[$c->{$id}])) {
             $output .= $this->display_level($options, $c->{$id}, in_array($c->{$id}, $this->meta) && $active);
         }
     }
     $output .= '</div>';
     return $output;
 }
开发者ID:rilwis,项目名称:meta-box,代码行数:19,代码来源:select-tree.php

示例6: rwmb_the_value

 /**
  * Display the value of a field
  *
  * @param  string   $field_id Field ID. Required.
  * @param  array    $args     Additional arguments. Rarely used. See specific fields for details
  * @param  int|null $post_id  Post ID. null for current post. Optional.
  * @param  bool     $echo     Display field meta value? Default `true` which works in almost all cases. We use `false` for  the [rwmb_meta] shortcode
  *
  * @return string
  */
 function rwmb_the_value($field_id, $args = array(), $post_id = null, $echo = true)
 {
     $args = wp_parse_args($args);
     $field = RWMB_Helper::find_field($field_id, $post_id);
     if (!$field) {
         return '';
     }
     $output = RWMB_Field::call('the_value', $field, $args, $post_id);
     /**
      * Allow developers to change the returned value of field
      * For version < 4.8.2, the filter name was 'rwmb_get_field'
      *
      * @param mixed    $value   Field HTML output
      * @param array    $field   Field parameter
      * @param array    $args    Additional arguments. Rarely used. See specific fields for details
      * @param int|null $post_id Post ID. null for current post. Optional.
      */
     $output = apply_filters('rwmb_the_value', $output, $field, $args, $post_id);
     if ($echo) {
         echo $output;
     }
     return $output;
 }
开发者ID:sptheme,项目名称:learninginstitute,代码行数:33,代码来源:functions.php

示例7: normalize_fields

 /**
  * Normalize an array of fields
  * @param array $fields Array of fields
  * @return array $fields Normalized fields
  */
 public static function normalize_fields($fields)
 {
     foreach ($fields as $k => $field) {
         $field = RWMB_Field::call('normalize', $field);
         // Allow to add default values for fields
         $field = apply_filters('rwmb_normalize_field', $field);
         $field = apply_filters("rwmb_normalize_{$field['type']}_field", $field);
         $field = apply_filters("rwmb_normalize_{$field['id']}_field", $field);
         $fields[$k] = $field;
     }
     return $fields;
 }
开发者ID:jesusmarket,项目名称:jesusmarket,代码行数:17,代码来源:meta-box.php

示例8: array

 static function add_actions()
 {
     // Do same actions as file field
     parent::add_actions();
     add_action('wp_ajax_lpr_quiz_question_add', array(__CLASS__, 'quiz_question_add'));
     add_action('wp_ajax_lpr_quiz_question_remove', array(__CLASS__, 'quiz_question_remove'));
 }
开发者ID:thonysmith,项目名称:LearnPress,代码行数:7,代码来源:class-quiz-questions-field.php

示例9: normalize

 /**
  * Normalize parameters for field
  *
  * @param array $field
  *
  * @return array
  */
 static function normalize($field)
 {
     $field = parent::normalize($field);
     $field = wp_parse_args($field, array('prefix' => '', 'suffix' => '', 'std' => '', 'js_options' => array()));
     $field['js_options'] = wp_parse_args($field['js_options'], array('range' => 'min', 'value' => $field['std']));
     return $field;
 }
开发者ID:rilwis,项目名称:meta-box,代码行数:14,代码来源:slider.php

示例10: normalize

 /**
  * Normalize parameters for field
  *
  * @param array $field
  *
  * @return array
  */
 static function normalize($field)
 {
     $field = parent::normalize($field);
     $field = wp_parse_args($field, array('flatten' => true, 'query_args' => array(), 'field_type' => 'select'));
     if ('checkbox_tree' === $field['field_type']) {
         $field['field_type'] = 'checkbox_list';
         $field['flatten'] = false;
     }
     switch ($field['field_type']) {
         case 'checkbox_list':
         case 'radio_list':
             $field = wp_parse_args($field, array('collapse' => true));
             $field['flatten'] = 'radio_list' === $field['field_type'] ? true : $field['flatten'];
             $field['multiple'] = 'radio_list' === $field['field_type'] ? false : true;
             $field = RWMB_Input_Field::normalize($field);
             break;
         case 'select_advanced':
             $field = RWMB_Select_Advanced_Field::normalize($field);
             $field['flatten'] = true;
             break;
         case 'select_tree':
             $field = RWMB_Select_Field::normalize($field);
             $field['multiple'] = true;
             break;
         case 'select':
         default:
             $field = RWMB_Select_Field::normalize($field);
             break;
     }
     return $field;
 }
开发者ID:hefi1605,项目名称:meta-box,代码行数:38,代码来源:object-choice.php

示例11: array

 /**
  * Get the attributes for a field
  *
  * @param array $field
  * @param mixed $value
  *
  * @return array
  */
 static function get_attributes($field, $value = null)
 {
     $attributes = parent::get_attributes($field, $value);
     $attributes = wp_parse_args($attributes, array('cols' => $field['cols'], 'rows' => $field['rows'], 'maxlength' => $field['maxlength'], 'wrap' => $field['wrap'], 'readonly' => $field['readonly'], 'placeholder' => $field['placeholder']));
     $attributes['class'] .= ' large-text';
     return $attributes;
 }
开发者ID:shahinbdboy,项目名称:meta-box,代码行数:15,代码来源:textarea.php

示例12: array

 /**
  * Normalize parameters for field
  *
  * @param array $field
  *
  * @return array
  */
 static function normalize_field($field)
 {
     $field = parent::normalize_field($field);
     $field = wp_parse_args($field, array('cols' => 60, 'rows' => 3, 'maxlength' => false, 'wrap' => false, 'readonly' => false, 'placeholder' => ''));
     $field['attributes'] = wp_parse_args($field['attributes'], array('cols' => $field['cols'], 'rows' => $field['rows'], 'maxlength' => $field['maxlength'], 'wrap' => $field['wrap'], 'readonly' => $field['readonly'], 'placeholder' => $field['placeholder']));
     $field['attributes']['class'] .= ' large-text';
     return $field;
 }
开发者ID:riopse,项目名称:meta-box,代码行数:15,代码来源:textarea.php

示例13: normalize

 /**
  * Normalize parameters for field
  *
  * @param array $field
  * @return array
  */
 static function normalize($field)
 {
     $field = parent::normalize($field);
     $field = wp_parse_args($field, array('raw' => false, 'options' => array()));
     $field['options'] = wp_parse_args($field['options'], array('editor_class' => 'rwmb-wysiwyg', 'dfw' => true));
     // Keep the filter to be compatible with previous versions
     $field['options'] = apply_filters('rwmb_wysiwyg_settings', $field['options']);
     return $field;
 }
开发者ID:warfare-plugins,项目名称:social-warfare,代码行数:15,代码来源:wysiwyg.php

示例14: array

 /**
  * Normalize parameters for field
  *
  * @param array $field
  *
  * @return array
  */
 static function normalize_field($field)
 {
     $field = parent::normalize_field($field);
     $field = wp_parse_args($field, array('datalist' => false, 'readonly' => false));
     if ($field['datalist']) {
         $field['datalist'] = wp_parse_args($field['datalist'], array('id' => $field['id'] . '_list', 'options' => array()));
     }
     $field['attributes'] = wp_parse_args($field['attributes'], array('list' => $field['datalist'] ? $field['datalist']['id'] : false, 'readonly' => $field['readonly']));
     return $field;
 }
开发者ID:riopse,项目名称:meta-box,代码行数:17,代码来源:input.php

示例15: array

 /**
  * Normalize parameters for field
  *
  * @param array $field
  *
  * @return array
  */
 static function normalize_field($field)
 {
     if (!$field['clone'] && $field['multiple']) {
         $field['field_name'] .= '[]';
     }
     $field = parent::normalize_field($field);
     $field = wp_parse_args($field, array('size' => $field['multiple'] ? 5 : 0));
     $field['attributes'] = wp_parse_args($field['attributes'], array('multiple' => $field['multiple'], 'size' => $field['size']));
     return $field;
 }
开发者ID:ldudzic,项目名称:meta-box,代码行数:17,代码来源:select.php


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