Settings::maybe_hijack_save_network_settings( array $options, string $admin_page )
Maybe hijack the saving for the network settings page, when not in TEC network settings.
Contents
The purpose is to merge the settings between plugins.
Parameters
- $options
-
(array) (Required) Formatted the same as from get_options().
- $admin_page
-
(string) (Required) The admin page being saved.
Return
(array) $options Formatted the same as from get_options(), maybe modified.
Source
File: src/Tribe/Admin/Settings.php
public function maybe_hijack_save_network_settings( $options, $admin_page ) {
// If we're saving the network settings page for TEC, bail.
if ( ! empty( $admin_page ) && static::$settings_page_id == $admin_page ) {
return $options;
}
if ( ! is_plugin_active_for_network( 'the-events-calendar/the-events-calendar.php' ) ) {
return $options;
}
$tec_tabs = $this->get_events_settings_tabs_ids();
$form_options['hideSettingsTabs'] = $_POST['hideSettingsTabs'];
// Iterate over the TEC settings tab ids and merge the network settings.
foreach ( $tec_tabs as $tab => $key ) {
if ( in_array( $key, $options['hideSettingsTabs'] ) ) {
$_POST['hideSettingsTabs'][] = $key;
$form_options['hideSettingsTabs'][] = $key;
}
}
return $form_options;
}
Changelog
| Version | Description |
|---|---|
| 5.15.0 | Introduced. |