How to Use Attributes

How to Use Attributes

You can use some attibutes for fields. Let’s see some examples for how to use attributes.

array(
  'id'            => 'unique_option_101',
  'type'          => 'text',
  'title'         => 'Text Field',
  'attributes'    => array(
    'maxlength'   => 10,
    'placeholder' => 'do stuff',
    'readyonly'   => 'only-key'
    'disabled'    => 'only-key'
  ),
),

array(
  'id'            => 'unique_option_102',
  'type'          => 'textarea',
  'title'         => 'Text Field',
  'attributes'    => array(
    'rows'        => 10,
    'cols'        => 5,
    'placeholder' => 'do stuff',
  ),
),

array(
  'id'         => 'unique_option_103',
  'type'       => 'select',
  'title'      => 'Select Field',
  'options'    => array(
    'green'    => 'Green',
    'blue'     => 'Blue',
    'yellow'   => 'Yellow',
  ),
  'attributes' => array(
    'multiple' => 'multiple',
    'style'    => 'width: 125px; height: 125px;',
  ),
),

Last updated