WPCF7_REST_Controller::get_properties()privateCF7 1.0

Метод класса: WPCF7_REST_Controller{}

Хуков нет.

Возвращает

null. Ничего (null).

Использование

// private - только в коде основоного (родительского) класса
$result = $this->get_properties( $contact_form );
$contact_form(WPCF7_ContactForm) (обязательный)
-

Код WPCF7_REST_Controller::get_properties() CF7 5.9.3

private function get_properties( WPCF7_ContactForm $contact_form ) {
	$properties = $contact_form->get_properties();

	$properties['form'] = array(
		'content' => (string) $properties['form'],
		'fields' => array_map(
			static function ( WPCF7_FormTag $form_tag ) {
				return array(
					'type' => $form_tag->type,
					'basetype' => $form_tag->basetype,
					'name' => $form_tag->name,
					'options' => $form_tag->options,
					'raw_values' => $form_tag->raw_values,
					'labels' => $form_tag->labels,
					'values' => $form_tag->values,
					'pipes' => $form_tag->pipes instanceof WPCF7_Pipes
						? $form_tag->pipes->to_array()
						: $form_tag->pipes,
					'content' => $form_tag->content,
				);
			},
			$contact_form->scan_form_tags()
		),
	);

	$properties['additional_settings'] = array(
		'content' => (string) $properties['additional_settings'],
		'settings' => array_filter( array_map(
			static function ( $setting ) {
				$pattern = '/^([a-zA-Z0-9_]+)[\t ]*:(.*)$/';

				if ( preg_match( $pattern, $setting, $matches ) ) {
					$name = trim( $matches[1] );
					$value = trim( $matches[2] );

					if ( in_array( $value, array( 'on', 'true' ), true ) ) {
						$value = true;
					} elseif ( in_array( $value, array( 'off', 'false' ), true ) ) {
						$value = false;
					}

					return array( $name, $value );
				}

				return false;
			},
			explode( "\n", $properties['additional_settings'] )
		) ),
	);

	return $properties;
}