Settings::maybe_hijack_save_network_settings( array $options, string $admin_page )
Maybe hijack the saving for the network settings page.
Contents
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 tickets, bail.
if ( ! empty( $admin_page ) && static::$settings_page_id === $admin_page ) {
return $options;
}
if ( ! is_plugin_active_for_network( 'event-tickets/event-tickets.php' ) ) {
return $options;
}
$tickets_tabs = $this->get_tickets_settings_tabs_ids();
$form_options['hideSettingsTabs'] = $_POST['hideSettingsTabs'];
// Iterate over the Tickets settings tab ids and merge the network settings.
foreach ( $tickets_tabs as $tab => $key ) {
if ( in_array( $key, $options['hideSettingsTabs'] ) ) {
$_POST['hideSettingsTabs'][] = $key;
$form_options['hideSettingsTabs'][] = $key;
}
}
return $form_options;
}
Changelog
| Version | Description |
|---|---|
| 5.4.0 | Introduced. |