Text

The following extra arguments may be added to the option id ‘text’

Name

Type

Default

Description

dynamic

Array

The text option supports dynamic content such as post title, excerpt, post id etc.

  $options->add_option(
 'option_text',
   [
     'type'        => 'text',
     'description' => __( 'Set text description', 'zionbuilder' ),
     'title'       => __( 'Title text', 'zionbuilder' ),                
     'dynamic'     => [
         'enabled' => true,
   ],                
 ]
);

icon

String

Name of the icon that appears at the end of the input

clearable

Boolean

Controls if the ‘x’ icon which clears the input text should appear.

size

String

Can be ‘narrow’, ‘big’

error

Boolean

false

If true, will mark the field as red

Text option with dynamic enabled and clearable true

As a basic example:

public function options( $options ) {
        $options->add_option(
            'option_text',
            [
                'type'        => 'text',
                'description' => __( 'Set text description', 'zionbuilder' ),
                'title'       => __( 'Title text', 'zionbuilder' ),
                'default'     => __( 'Default string value', 'zionbuilder' ),
                'dynamic'     => [
                    'enabled' => true,
                ],
                'size'        => 'narrow',
                'icon'        => 'search',
                'clearable'   => true,
                'error'       => false,
            ]
        );

}

Last updated

Was this helpful?