Registers the settings, tabs, sections and fields for this page in WordPress.
Description
Source
File: src/db-objects/forms/form-settings-page.php
public function register() { $this->add_page_content(); foreach ( $this->tabs as $id => $tab_args ) { foreach ( $tab_args['field_manager']->get_fields() as $field ) { if ( ! isset( $this->sections[ $field->section ] ) ) { continue; } if ( ! isset( $this->subtabs[ $this->sections[ $field->section ]['subtab'] ] ) ) { continue; } $tab_subtab_slug = $this->subtabs[ $this->sections[ $field->section ]['subtab'] ]['tab'] . '_' . $this->sections[ $field->section ]['subtab']; add_settings_field( $field->id, $field->label, array( $this, 'render_field' ), $tab_subtab_slug, $field->section, array( 'label_for' => $tab_args['field_manager']->make_id( $field->id ), 'field_instance' => $field, ) ); } register_setting( $id, $id ); add_filter( "sanitize_option_{$id}", array( $this, 'validate' ), 10, 2 ); } foreach ( $this->sections as $id => $section_args ) { if ( ! isset( $this->subtabs[ $section_args['subtab'] ] ) ) { continue; } $tab_subtab_slug = $this->subtabs[ $section_args['subtab'] ]['tab'] . '_' . $section_args['subtab']; add_settings_section( $id, $section_args['title'], array( $this, 'render_section_description' ), $tab_subtab_slug ); } }
Changelog
Version | Description |
---|---|
1.0.0 | Introduced. |