Warning: Array to string conversion in /home/customer/www/docs.automatorplugin.com/public_html/wp-content/themes/wporg-developer/inc/template-tags.php on line 825

Warning: foreach() argument must be of type array|object, string given in /home/customer/www/docs.automatorplugin.com/public_html/wp-content/themes/wporg-developer/inc/template-tags.php on line 830

Warning: Array to string conversion in /home/customer/www/docs.automatorplugin.com/public_html/wp-content/themes/wporg-developer/inc/template-tags.php on line 825
Automator_Helpers_Recipe_Field::create_field( $args = array() )


Warning: foreach() argument must be of type array|object, string given in /home/customer/www/docs.automatorplugin.com/public_html/wp-content/themes/wporg-developer/inc/template-tags.php on line 830

Warning: Array to string conversion in /home/customer/www/docs.automatorplugin.com/public_html/wp-content/themes/wporg-developer/inc/template-tags.php on line 825

Parameters Parameters

$args

(Optional)

Default value: array()


Top ↑

Return Return

(mixed|void)


Source Source

File: src/core/lib/helpers/class-automator-recipe-helpers-field.php

	public function create_field( array $args = array() ) {
		$defaults    = array(
			'option_code' => 'INT',
			'label'       => esc_attr__( 'Number', 'uncanny-automator' ),
			'description' => '',
			'placeholder' => esc_attr__( 'Example: 1', 'uncanny-automator' ),
			'required'    => true,
			'input_type'  => 'int',
			'default'     => '',
		);
		$args        = wp_parse_args( $args, $defaults );
		$option_code = $args['option_code'];
		$label       = $args['label'];
		$description = $args['description'];
		$placeholder = $args['placeholder'];
		$required    = $args['required'];
		$default     = $args['default'];
		$option = array(
			'option_code'   => $option_code,
			'label'         => $label,
			'description'   => $description,
			'placeholder'   => $placeholder,
			'input_type'    => 'int',
			'required'      => $required,
			'default_value' => $default,
		);
		return apply_filters( 'automator_option_' . strtolower( $option_code ) . '_field', $option, $args );
	}