get_attributes() public static method

Get the attributes for a field
public static get_attributes ( array $field, mixed $value = null ) : array
$field array
$value mixed
return array
コード例 #1
0
ファイル: checkbox.php プロジェクト: sydneycbd/meta-box
 /**
  * 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['type'] = 'checkbox';
     $attributes['list'] = false;
     return $attributes;
 }
コード例 #2
0
ファイル: text.php プロジェクト: tamalsarker/meta-box
 /**
  * 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('size' => $field['size'], 'maxlength' => $field['maxlength'], 'pattern' => $field['pattern'], 'placeholder' => $field['placeholder']));
     $attributes['type'] = 'text';
     return $attributes;
 }
コード例 #3
0
 /**
  * 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('step' => $field['step'], 'max' => $field['max'], 'min' => $field['min']));
     $attributes['type'] = 'number';
     return $attributes;
 }
コード例 #4
0
ファイル: meta-box-custom.php プロジェクト: websideas/Mondova
 static function get_attributes($field, $value = null)
 {
     $attributes = RWMB_Input_Field::get_attributes($field, $value);
     $attributes['id'] = false;
     $attributes['type'] = 'radio';
     $attributes['value'] = $value;
     return $attributes;
 }
コード例 #5
0
ファイル: input-list.php プロジェクト: rilwis/meta-box
 /**
  * Get the attributes for a field
  *
  * @param array $field
  * @param mixed $value
  *
  * @return array
  */
 public static function get_attributes($field, $value = null)
 {
     $attributes = RWMB_Input_Field::get_attributes($field, $value);
     $attributes['id'] = false;
     $attributes['type'] = $field['multiple'] ? 'checkbox' : 'radio';
     $attributes['value'] = $value;
     return $attributes;
 }
コード例 #6
0
ファイル: radio.php プロジェクト: fkallevik/meta-box
 /**
  * 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['list'] = false;
     $attributes['id'] = false;
     $attributes['type'] = 'radio';
     return $attributes;
 }
コード例 #7
0
ファイル: object-choice.php プロジェクト: ahmadawais/meta-box
 /**
  * Get the attributes for a field
  *
  * @param array $field
  * @param mixed $value
  *
  * @return array
  */
 static function get_attributes($field, $value = null)
 {
     switch ($field['field_type']) {
         case 'checkbox_list':
         case 'radio_list':
             $attributes = RWMB_Input_Field::get_attributes($field, $value);
             $attributes['class'] = "rwmb-choice";
             $attributes['id'] = false;
             $attributes['type'] = 'radio_list' === $field['field_type'] ? 'radio' : 'checkbox';
             break;
         case 'select_advanced':
             $attributes = RWMB_Select_Advanced_Field::get_attributes($field, $value);
             $attributes['class'] = "rwmb-choice rwmb-select_advanced";
             break;
         case 'select_tree':
             $attributes = RWMB_Select_Field::get_attributes($field, $value);
             $attributes['multiple'] = false;
             break;
         case 'select':
         default:
             $attributes = RWMB_Select_Field::get_attributes($field, $value);
             break;
     }
     $attributes['name'] .= !$field['clone'] && $field['multiple'] ? '[]' : '';
     return $attributes;
 }
コード例 #8
0
 /**
  * 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['type'] = 'hidden';
     return $attributes;
 }