Returns all modules with the given state.
public get_modules ( integer $state = self::MODULE_STATE_ALL ) : |
||
$state | integer | Optional. State of the modules. Defaults to all modules. |
return | Array of module objects. |
/** * Renders the markup. * * @since 3.0.0 * * @return void */ public function render() { $this->asset_manager->enqueue_style('multilingualpress-admin'); $action = PluginSettingsUpdater::ACTION; ?> <div class="wrap"> <h1><?php echo esc_html(get_admin_page_title()); ?> </h1> <form method="post" action="<?php echo admin_url("admin-post.php?action={$action}"); ?> " id="multilingualpress-modules"> <?php echo \Inpsyde\MultilingualPress\nonce_field($this->nonce); ?> <table class="mlp-module-list"> <?php foreach ($this->module_manager->get_modules() as $id => $module) { /** * Filters if the module should be listed on the settings page. * * @since 3.0.0 * * @param bool $show_module Whether or not the module should be listed on the settings page. */ if (apply_filters("multilingualpress.show_module_{$id}", true)) { $this->render_module($module); } } /** * Fires at the end of but still inside the module list on the settings page. * * @since 3.0.0 */ do_action('multilingualpress.in_module_list'); ?> </table> <?php /** * Fires right after after the module list on the settings page. * * @since 3.0.0 */ do_action('multilingualpress.after_module_list'); submit_button(__('Save Changes', 'multilingual-press')); ?> </form> </div> <?php }
/** * Updates the plugin settings according to the data in the request. * * @since 3.0.0 * * @return void */ public function update_settings() { \Inpsyde\MultilingualPress\check_admin_referer($this->nonce); array_walk(array_keys($this->module_manager->get_modules()), [$this, 'update_module']); $this->module_manager->save_modules(); /** * Runs before the redirect. * * Process your fields in the $_POST superglobal here and then call update_site_option(). * * @param array $_POST */ do_action('mlp_modules_save_fields', $_POST); wp_safe_redirect(add_query_arg('message', 'updated', $this->settings_page->url())); \Inpsyde\MultilingualPress\call_exit(); }