Automator_Helpers_Recipe_Field::create_field( array $args = array() )


Parameters Parameters

$args

(array) (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 );

	}