Automator_Helpers_Recipe_Field::text( 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 text( array $args = array() ) {
		$defaults    = array(
			'option_code' => 'TEXT',
			'input_type'  => 'text',
			'label'       => esc_attr__( 'Text', 'uncanny-automator' ),
			'placeholder' => '',
			'description' => '',
			'required'    => true,
			'tokens'      => true,
			'default'     => null,
		);
		$args        = wp_parse_args( $args, $defaults );
		$option_code = $args['option_code'];
		$label       = $args['label'];
		$description = $args['description'];
		$placeholder = $args['placeholder'];
		$tokens      = $args['tokens'];
		$type        = $args['input_type'];
		$default     = $args['default'];
		$required    = $args['required'];

		$option = array(
			'option_code'     => $option_code,
			'label'           => $label,
			'description'     => $description,
			'placeholder'     => $placeholder,
			'input_type'      => $type,
			'supports_tokens' => $tokens,
			'required'        => $required,
			'default_value'   => $default,
		);

		if ( 'textarea' === $type ) {
			$option['supports_tinymce'] = true;
		}

		return apply_filters( 'automator_option_text_field', $option );
	}