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
Esempio n. 1
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'] = 'checkbox';
     $attributes['list'] = false;
     return $attributes;
 }
Esempio n. 2
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('size' => $field['size'], 'maxlength' => $field['maxlength'], 'pattern' => $field['pattern'], 'placeholder' => $field['placeholder']));
     $attributes['type'] = 'text';
     return $attributes;
 }
Esempio n. 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;
 }
Esempio n. 4
0
 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;
 }
Esempio n. 5
0
 /**
  * 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;
 }
Esempio n. 6
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['list'] = false;
     $attributes['id'] = false;
     $attributes['type'] = 'radio';
     return $attributes;
 }
Esempio n. 7
0
 /**
  * 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;
 }
Esempio n. 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;
 }