Module::add_settings( awsmug\Torro_Forms\DB_Objects\Forms\Form_Settings_Page $settings_page )

Adds settings subtabs, sections and fields for the module to the plugin settings page.

Description

See also

Parameters

$settings_page

(awsmug\Torro_Forms\DB_Objects\Forms\Form_Settings_Page) (Required) Settings page instance.

Source

File: src/modules/module.php

	protected final function add_settings( $settings_page ) {
		$subtabs = $this->get_settings_subtabs();
		if ( empty( $subtabs ) ) {
			return;
		}

		$sections = $this->get_settings_sections();
		$fields   = $this->get_settings_fields();

		$tab_id = $this->get_settings_identifier();

		$settings_page->add_tab( $tab_id, array(
			'title' => $this->get_title(),
			/* translators: %s: module title */
			'rest_description' => sprintf( _x( 'Torro Forms %s module settings.', 'REST API description', 'torro-forms' ), $this->get_title() ),
		) );

		foreach ( $subtabs as $slug => $args ) {
			$args['tab'] = $tab_id;

			$settings_page->add_subtab( $slug, $args );
		}

		foreach ( $sections as $slug => $args ) {
			$settings_page->add_section( $slug, $args );
		}

		foreach ( $fields as $slug => $args ) {
			$type = 'text';
			if ( isset( $args['type'] ) ) {
				$type = $args['type'];
				unset( $args['type'] );
			}

			$settings_page->add_field( $slug, $type, $args );
		}
	}

Changelog

Changelog
Version Description
1.0.0 Introduced.