示例#1
0
 /**
  * Class constructor.
  *
  * For an overview of the supported arguments, please read the Field Types Reference.
  *
  * @since 0.5.0
  * @param string $type the field type
  * @param array $args array of field type arguments
  */
 public function __construct($type, $args)
 {
     $args = wp_parse_args($args, array('store' => 'id', 'mime_types' => 'all'));
     if ('url' !== $args['store']) {
         $args['store'] = 'id';
     }
     parent::__construct($type, $args);
 }
示例#2
0
 /**
  * Class constructor.
  *
  * For an overview of the supported arguments, please read the Field Types Reference.
  *
  * @since 0.5.0
  * @param string $type the field type
  * @param array $args array of field type arguments
  */
 public function __construct($type, $args)
 {
     parent::__construct($type, $args);
     if (isset($args['label'])) {
         $this->args['label'] = $args['label'];
     } else {
         $this->args['label'] = __('Enable?', 'wpdlib');
     }
 }
示例#3
0
 /**
  * Class constructor.
  *
  * For an overview of the supported arguments, please read the Field Types Reference.
  *
  * @since 0.5.0
  * @param string $type the field type
  * @param array $args array of field type arguments
  */
 public function __construct($type, $args)
 {
     $args = wp_parse_args($args, array('options' => array()));
     parent::__construct($type, $args);
     if (is_array($this->args['options']) && 1 === count($this->args['options'])) {
         if (isset($this->args['options']['posts']) || isset($this->args['options']['terms']) || isset($this->args['options']['users'])) {
             add_action('wp_loaded', array($this, 'parse_options'));
         }
     }
 }
示例#4
0
文件: Map.php 项目: felixarntz/wpdlib
 /**
  * Class constructor.
  *
  * For an overview of the supported arguments, please read the Field Types Reference.
  *
  * @since 0.6.0
  * @param string $type the field type
  * @param array $args array of field type arguments
  */
 public function __construct($type, $args)
 {
     $args = wp_parse_args($args, array('store' => 'address'));
     if ('coords' !== $args['store']) {
         $args['store'] = 'address';
     } elseif (!isset($args['placeholder'])) {
         $args['placeholder'] = __('Enter coords in the format "latitude|longitude"', 'wpdlib');
     }
     parent::__construct($type, $args);
 }
示例#5
0
 /**
  * Class constructor.
  *
  * For an overview of the supported arguments, please read the Field Types Reference.
  *
  * @since 0.5.0
  * @param string $type the field type
  * @param array $args array of field type arguments
  */
 public function __construct($type, $args)
 {
     $args = wp_parse_args($args, array('repeatable' => array()));
     if (!is_array($args['repeatable'])) {
         $args['repeatable'] = array();
     }
     if (!isset($args['repeatable']['limit'])) {
         $args['repeatable']['limit'] = 0;
     } else {
         $args['repeatable']['limit'] = absint($args['repeatable']['limit']);
     }
     if (!isset($args['repeatable']['fields']) || !is_array($args['repeatable']['fields'])) {
         $args['repeatable']['fields'] = array();
     }
     parent::__construct($type, $args);
     foreach ($this->args['repeatable']['fields'] as $field_slug => $field_args) {
         $field = FieldManager::get_instance($field_args);
         if ($field !== null) {
             $this->fields[$field_slug] = $field;
         }
     }
 }
示例#6
0
 /**
  * Class constructor.
  *
  * For an overview of the supported arguments, please read the Field Types Reference.
  *
  * @since 0.5.0
  * @param string $type the field type
  * @param array $args array of field type arguments
  */
 public function __construct($type, $args)
 {
     $args = wp_parse_args($args, array('min' => '', 'max' => ''));
     parent::__construct($type, $args);
 }
示例#7
0
 /**
  * Class constructor.
  *
  * For an overview of the supported arguments, please read the Field Types Reference.
  *
  * @since 0.5.0
  * @param string $type the field type
  * @param array $args array of field type arguments
  */
 public function __construct($type, $args)
 {
     $args = wp_parse_args($args, array('rows' => 5));
     parent::__construct($type, $args);
 }