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
ファイル: select-tree.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 = parent::get_attributes($field, $value);
     $attributes['multiple'] = false;
     $attributes['id'] = false;
     return $attributes;
 }
コード例 #2
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;
 }
コード例 #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('data-options' => wp_json_encode($field['js_options'])));
     return $attributes;
 }
コード例 #4
0
 /**
  * Get the attributes for a field
  *
  * @param array $field
  * @param mixed $value
  *
  * @return array
  */
 public static function get_attributes($field, $value = null)
 {
     switch ($field['field_type']) {
         case 'checkbox_list':
         case 'radio_list':
             return RWMB_Input_List_Field::get_attributes($field, $value);
             break;
         case 'select_advanced':
             $attributes = RWMB_Select_Advanced_Field::get_attributes($field, $value);
             $attributes['class'] .= ' rwmb-select_advanced';
             return $attributes;
             break;
         case 'select_tree':
             return RWMB_Select_Tree_Field::get_attributes($field, $value);
             break;
         case 'select':
         default:
             return RWMB_Select_Field::get_attributes($field, $value);
             break;
     }
 }