Astra_Builder::render_header_dynamic_components( string $slug, string $device )

Render header dynamic components.


Description


Parameters

$slug

(string) (Required) slug.

$device

(string) (Required) device.


Source

File: classes/class-astra-builder.php

		public function render_header_dynamic_components( $slug ) {

			if ( 0 === strpos( $slug, 'html' ) ) {
				?>
				<div class="ast-builder-layout-element site-header-focus-item ast-header-<?php echo esc_attr( $slug ); ?>" data-section="section-hb-<?php echo esc_attr( $slug ); ?>">
					<?php
					$action_name = 'astra_header_' . str_replace( '-', '_', $slug );
					do_action( $action_name );
					?>
				</div>
				<?php
			} elseif ( 0 === strpos( $slug, 'button' ) ) {
				?>
				<div class="ast-builder-layout-element site-header-focus-item ast-header-<?php echo esc_attr( $slug ); ?>" data-section="section-hb-<?php echo esc_attr( $slug ); ?>">
					<?php
					$action_name = 'astra_header_' . str_replace( '-', '_', $slug );
					do_action( $action_name );
					?>
				</div>
				<?php
			} elseif ( 0 === strpos( $slug, 'widget' ) ) {
				?>
				<aside
					<?php
					echo astra_attr(
						'header-widget-area-inner',
						array(
							'class'        => 'header-widget-area widget-area site-header-focus-item',
							'data-section' => 'sidebar-widgets-header-' . esc_attr( $slug ),
						)
					);
					?>
					>
					<?php
					if ( is_customize_preview() && class_exists( 'Astra_Builder_UI_Controller' ) ) {
						Astra_Builder_UI_Controller::render_customizer_edit_button();
					}
					echo function_exists( 'astra_markup_open' ) ? astra_markup_open( 'header-widget-div', array( 'echo' => false ) ) : '<div class="header-widget-area-inner site-info-inner">'; // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped
					astra_get_sidebar( 'header-' . str_replace( '_', '-', $slug ) );
					echo function_exists( 'astra_markup_close' ) ? astra_markup_close( 'header-widget-div', array( 'echo' => false ) ) : '</div>'; // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped
					?>
				</aside>
				<?php
			} elseif ( 0 === strpos( $slug, 'menu' ) ) {
				?>
				<div class="ast-builder-<?php echo esc_attr( $slug ); ?> ast-builder-menu ast-builder-<?php echo esc_attr( $slug ); ?>-focus-item ast-builder-layout-element site-header-focus-item" data-section="section-hb-<?php echo esc_attr( $slug ); ?>">
					<?php
					$action_name = 'astra_header_' . str_replace( '-', '_', $slug );
					do_action( $action_name );
					?>
				</div>
				<?php
			} elseif ( 0 === strpos( $slug, 'social-icons' ) ) {
				$index = str_replace( 'social-icons-', '', $slug );
				?>
				<div class="ast-builder-layout-element site-header-focus-item" data-section="section-hb-social-icons-<?php echo esc_attr( $index ); ?>">
					<?php
					$action_name = 'astra_header_social_' . $index;
					do_action( $action_name );
					?>
				</div>
				<?php
			} elseif ( 0 === strpos( $slug, 'divider' ) ) {
				$layout_class = astra_get_option( 'header-' . $slug . '-layout' );
				?>
					<div class="ast-builder-layout-element site-header-focus-item ast-header-divider-element ast-header-<?php echo esc_attr( $slug ); ?> ast-hb-divider-layout-<?php echo esc_attr( $layout_class ); ?>" data-section="section-hb-<?php echo esc_attr( $slug ); ?>">
					<?php
						$action_name = 'astra_header_' . str_replace( '-', '_', $slug );
						do_action( $action_name );
					?>
					</div>
				<?php
			} elseif ( 0 === strpos( $slug, 'language-switcher' ) ) {
				$layout_class = astra_get_option( 'header-' . $slug . '-layout' );
				?>
					<div class="ast-builder-layout-element site-header-focus-item ast-header-language-switcher-element ast-header-<?php echo esc_attr( $slug ); ?> ast-hb-language-switcher-layout-<?php echo esc_attr( $layout_class ); ?>" data-section="section-hb-<?php echo esc_attr( $slug ); ?>">
					<?php
						$action_name = 'astra_header_' . str_replace( '-', '_', $slug );
						do_action( $action_name );
					?>
					</div>
				<?php
			}

		}


User Contributed Notes

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