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
Exemplo 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 = 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;
 }
Exemplo 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['type'] = 'hidden';
     $attributes['name'] .= !$field['clone'] && $field['multiple'] ? '[]' : '';
     $attributes['disabled'] = true;
     $attributes['id'] = false;
     $attributes['value'] = $value;
     return $attributes;
 }
Exemplo 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('list' => $field['datalist'] ? $field['datalist']['id'] : false, 'readonly' => $field['readonly'], 'value' => $value, 'placeholder' => $field['placeholder']));
     return $attributes;
 }
Exemplo n.º 4
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('multiple' => $field['multiple'], 'size' => $field['size']));
     return $attributes;
 }
Exemplo n.º 5
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['class'] .= ' button hide-if-no-js';
     return $attributes;
 }