Returns the available settings fields for the module.
Description
See also
Return
(array) Associative array of <code>$field_slug => $field_args</code> pairs.
Source
File: src/modules/submodule-registry-trait.php
protected function get_settings_fields() { $fields = array(); foreach ( $this->submodules as $slug => $submodule ) { if ( ! is_a( $submodule, Settings_Submodule_Interface::class ) ) { continue; } $submodule_settings_identifier = $submodule->get_settings_identifier(); $submodule_settings_fields = $submodule->get_settings_fields(); foreach ( $submodule_settings_fields as $field_slug => $field_data ) { $field_slug = $submodule_settings_identifier . '__' . $field_slug; if ( ! empty( $field_data['section'] ) ) { $field_data['section'] = $submodule_settings_identifier . '__' . $field_data['section']; } if ( isset( $field_data['dependencies'] ) ) { $dependency_count = count( $field_data['dependencies'] ); for ( $i = 0; $i < $dependency_count; $i++ ) { if ( isset( $field_data['dependencies'][ $i ]['fields'] ) ) { $field_count = count( $field_data['dependencies'][ $i ]['fields'] ); for ( $j = 0; $j < $field_count; $j++ ) { $field_data['dependencies'][ $i ]['fields'][ $j ] = $submodule_settings_identifier . '__' . $field_data['dependencies'][ $i ]['fields'][ $j ]; } } } } $fields[ $field_slug ] = $field_data; } } return $fields; }
Changelog
Version | Description |
---|---|
1.0.0 | Introduced. |