Astra_Ext_Advanced_Hooks_Loader::admin_print_tabs( array $views )

Print admin tabs.


Description

Used to output the custom layouts on basis of their types.

Fired by views_edit-astra-advanced-hook filter.


Parameters

$views

(array) (Required) An array of available list table views.


Return

(array) An updated array of available list table views.


Source

File: addons/advanced-hooks/classes/class-astra-ext-advanced-hooks-loader.php

		public function admin_print_tabs( $views ) {

			$current_type = '';
			$active_class = ' nav-tab-active';
			$current_tab  = $this->get_active_tab();

			if ( ! empty( $_REQUEST['layout_type'] ) ) { // phpcs:ignore WordPress.Security.NonceVerification.Recommended
				$current_type = $_REQUEST['layout_type']; // phpcs:ignore WordPress.Security.NonceVerification.Recommended
				$active_class = '';
			}

			$url_args = array(
				'post_type'   => ASTRA_ADVANCED_HOOKS_POST_TYPE,
				'layout_type' => $current_tab,
			);

			$custom_layout_types = array(
				'header'   => __( 'Header', 'astra-addon' ),
				'footer'   => __( 'Footer', 'astra-addon' ),
				'hooks'    => __( 'Hooks', 'astra-addon' ),
				'404-page' => __( '404 Page', 'astra-addon' ),
				'content'  => __( 'Page Content', 'astra-addon' ),
			);

			$baseurl = add_query_arg( $url_args, admin_url( 'edit.php' ) );

			?>
				<div class="nav-tab-wrapper ast-custom-layout-tabs-wrapper">
					<a class="nav-tab<?php echo esc_attr( $active_class ); ?>" href="<?php echo esc_url( admin_url( 'edit.php?post_type=' . ASTRA_ADVANCED_HOOKS_POST_TYPE ) ); ?>">
						<?php
							echo esc_html__( 'All', 'astra-addon' );
						?>
					</a>
					<?php
					foreach ( $custom_layout_types as $type => $title ) {
						$type_url     = esc_url( add_query_arg( 'layout_type', $type, $baseurl ) );
						$active_class = ( $current_type === $type ) ? ' nav-tab-active' : '';

						?>
								<a class="nav-tab<?php echo esc_attr( $active_class ); ?>" href="<?php echo esc_url( $type_url ); ?>">
								<?php
									echo esc_attr( $title );
								?>
								</a>
							<?php
					}
					?>
				</div>
			<?php

			return $views;
		}

Changelog

Changelog
Version Description
3.6.4 Introduced.

User Contributed Notes

You must log in before being able to contribute a note or feedback.