RTMediaAdmin::render_admin_ui PHP Method

render_admin_ui() public static method

public static render_admin_ui ( $page, $sub_tabs, $args = [] )
        public static function render_admin_ui($page, $sub_tabs, $args = array())
        {
            // wrapper class
            $wrapper_class = '';
            if (!empty($args['wrapper_class']) && is_array($args['wrapper_class'])) {
                $wrapper_class = implode(' ', $args['wrapper_class']);
            }
            // tabs
            if ('rtmedia-settings' === $page) {
                $sub_tabs = apply_filters('rtmedia_pro_settings_tabs_content', $sub_tabs);
                ksort($sub_tabs);
            }
            $tab_position_class = 'rtm-vertical-tabs';
            if ('rtmedia-addons' === $page) {
                $tab_position_class = 'rtm-horizotanl-tabs';
            }
            ?>

			<div
				class="clearfix <?php 
            echo esc_attr($tab_position_class);
            ?>
 rtm-admin-tab-container <?php 
            echo esc_attr($wrapper_class);
            ?>
">
				<ul class="rtm-tabs">
					<?php 
            $i = 1;
            foreach ($sub_tabs as $tab) {
                // tab status
                $active_class = $error_class = '';
                if (!empty($tab['args']) && (empty($tab['args']['status']) || 'valid' !== $tab['args']['status'])) {
                    $error_class = 'error';
                }
                if (1 === $i) {
                    $active_class = 'active';
                }
                // tab icon
                $icon = '';
                if (isset($tab['icon']) && !empty($tab['icon'])) {
                    $icon = '<i class="' . esc_attr($tab['icon']) . ' dashicons rtmicon"></i>';
                }
                ?>
						<li class="<?php 
                echo esc_attr($active_class);
                ?>
 <?php 
                echo esc_attr($error_class);
                ?>
">
							<a id="tab-<?php 
                echo esc_attr(substr($tab['href'], 1));
                ?>
" title="<?php 
                echo esc_attr($tab['title']);
                ?>
"
							   href="<?php 
                echo esc_url($tab['href']);
                ?>
"
							   class="rtmedia-tab-title <?php 
                echo esc_attr(sanitize_title($tab['name']));
                ?>
">
								<?php 
                echo $icon;
                // @codingStandardsIgnoreLine
                ?>
<span><?php 
                echo esc_html($tab['name']);
                ?>
</span>
							</a>
						</li>
						<?php 
                $i++;
            }
            ?>
				</ul>

				<div class="tabs-content rtm-tabs-content">
					<?php 
            $k = 1;
            foreach ($sub_tabs as $tab) {
                $active_class = '';
                if (1 === $k) {
                    $active_class = ' active';
                }
                $k++;
                if (isset($tab['icon']) && !empty($tab['icon'])) {
                    $icon = '<i class="' . esc_attr($tab['icon']) . '"></i>';
                }
                $tab_without_hash = explode('#', $tab['href']);
                $tab_without_hash = $tab_without_hash[1];
                echo '<div class="rtm-content' . esc_attr($active_class) . '" id="' . esc_attr($tab_without_hash) . '">';
                if (isset($tab['args'])) {
                    call_user_func($tab['callback'], $page, $tab['args']);
                } else {
                    call_user_func($tab['callback'], $page);
                }
                echo '</div>';
            }
            ?>
				</div>

			</div>
			<?php 
        }

Usage Example

Example #1
0
 /**
  * Get themes.
  *
  * @access public
  *
  * @param  void
  *
  * @return void
  */
 public function get_themes()
 {
     $tabs = array();
     global $rtmedia_admin;
     $tabs[] = array('title' => __('Themes By rtCamp', 'rtmedia'), 'name' => __('Themes By rtCamp', 'rtmedia'), 'href' => '#rtmedia-themes', 'icon' => 'dashicons-admin-appearance', 'callback' => array($this, 'rtmedia_themes_content'));
     $tabs[] = array('title' => __('3rd Party Themes', 'rtmedia'), 'name' => __('3rd Party Themes', 'rtmedia'), 'href' => '#rtmedia-themes-3', 'icon' => 'dashicons-randomize', 'callback' => array($this, 'rtmedia_3rd_party_themes_content'));
     RTMediaAdmin::render_admin_ui(self::$page, $tabs);
 }
All Usage Examples Of RTMediaAdmin::render_admin_ui