* @copyright 2007-2022 Apollotheme * @license http://apollotheme.com - prestashop template provider */ namespace LeoElements\Core\RoleManager; use LeoElements\Settings_Page; use LeoElements\Settings; use LeoElements\Utils; use LeoElements\Leo_Helper; if ( ! defined( '_PS_VERSION_' ) ) { exit; // Exit if accessed directly. } class Role_Manager extends Settings_Page { const PAGE_ID = 'elementor-role-manager'; const ROLE_MANAGER_OPTION_NAME = 'exclude_user_roles'; /** * @since 2.0.0 * @access public */ public function get_role_manager_options() { return Leo_Helper::get_option( 'elementor_' . self::ROLE_MANAGER_OPTION_NAME, [] ); } /** * @since 2.0.0 * @access protected */ protected function get_page_title() { return Leo_Helper::__( 'Role Manager', 'elementor' ); } /** * @since 2.0.0 * @access public */ public function register_admin_menu() { add_submenu_page( Settings::PAGE_ID, $this->get_page_title(), $this->get_page_title(), 'manage_options', self::PAGE_ID, [ $this, 'display_settings_page' ] ); } /** * @since 2.0.0 * @access protected */ protected function create_tabs() { $validation_class = 'Elementor\Settings_Validations'; return [ 'general' => [ 'label' => Leo_Helper::__( 'General', 'elementor' ), 'sections' => [ 'tools' => [ 'fields' => [ 'exclude_user_roles' => [ 'label' => Leo_Helper::__( 'Exclude Roles', 'elementor' ), 'field_args' => [ 'type' => 'checkbox_list_roles', 'exclude' => [ 'super_admin', 'administrator' ], ], 'setting_args' => [ 'sanitize_callback' => [ $validation_class, 'checkbox_list' ], ], ], ], ], ], ], ]; } /** * @since 2.0.0 * @access public */ public function display_settings_page() { $this->get_tabs(); ?>