Astra_Get_Breadcrumb::execute( array $args )

Execute the ability.


Description


Parameters

$args

(array) (Required) Input arguments.


Return

(array) Result array.


Source

File: inc/abilities/customizer/general/breadcrumb/class-astra-get-breadcrumb.php

	public function execute( $args ) {
		if ( ! defined( 'ASTRA_THEME_SETTINGS' ) ) {
			return Astra_Abilities_Response::error(
				__( 'Astra theme is not active.', 'astra' ),
				__( 'Please activate the Astra theme to use this feature.', 'astra' )
			);
		}

		$position           = astra_get_option( 'breadcrumb-position', 'none' );
		$alignment          = astra_get_option( 'breadcrumb-alignment', 'left' );
		$separator_selector = astra_get_option( 'breadcrumb-separator-selector', '\003E' );
		$separator_custom   = astra_get_option( 'breadcrumb-separator', '' );

		$enable_on = array(
			'home_page'   => astra_get_option( 'breadcrumb-disable-home-page', '1' ) === '1',
			'blog_page'   => astra_get_option( 'breadcrumb-disable-blog-posts-page', '1' ) === '1',
			'search'      => astra_get_option( 'breadcrumb-disable-search', '1' ) === '1',
			'archive'     => astra_get_option( 'breadcrumb-disable-archive', '1' ) === '1',
			'single_page' => astra_get_option( 'breadcrumb-disable-single-page', '1' ) === '1',
			'single_post' => astra_get_option( 'breadcrumb-disable-single-post', '1' ) === '1',
			'singular'    => astra_get_option( 'breadcrumb-disable-singular', '1' ) === '1',
			'404_page'    => astra_get_option( 'breadcrumb-disable-404-page', '1' ) === '1',
		);

		$typography = array(
			'font_family' => astra_get_option( 'breadcrumb-font-family', 'inherit' ),
			'font_weight' => astra_get_option( 'breadcrumb-font-weight', 'inherit' ),
			'font_size'   => astra_get_option( 'breadcrumb-font-size', array() ),
			'font_extras' => astra_get_option( 'breadcrumb-font-extras', array() ),
		);

		$colors = array(
			'background'  => astra_get_option( 'breadcrumb-bg-color', array() ),
			'text'        => astra_get_option( 'breadcrumb-active-color-responsive', array() ),
			'separator'   => astra_get_option( 'breadcrumb-separator-color', array() ),
			'link_normal' => astra_get_option( 'breadcrumb-text-color-responsive', array() ),
			'link_hover'  => astra_get_option( 'breadcrumb-hover-color-responsive', array() ),
		);

		$spacing = astra_get_option( 'breadcrumb-spacing', array() );

		$position_labels = array(
			'none'                                 => 'None',
			'astra_header_primary_container_after' => 'Inside',
			'astra_header_after'                   => 'After',
			'astra_entry_top'                      => 'Before Title',
		);

		$alignment_labels = array(
			'left'   => 'Left',
			'center' => 'Center',
			'right'  => 'Right',
		);

		$separator_labels = array(
			'\003E'   => 'Type 1 (>)',
			'\00BB'   => 'Type 2 (»)',
			'\002F'   => 'Type 3 (/)',
			'unicode' => 'Custom',
		);

		return Astra_Abilities_Response::success(
			__( 'Retrieved breadcrumb settings successfully. IMPORTANT: When presenting any colors to the user, you MUST show visual color previews using this markdown format if valid color code: ![#HEXCODE](https://via.placeholder.com/15/HEXCODE/000000?text=+) `#HEXCODE` - Replace HEXCODE with the actual hex color value.', 'astra' ),
			array(
				'position'             => $position,
				'position_label'       => isset( $position_labels[ $position ] ) ? $position_labels[ $position ] : $position,
				'alignment'            => $alignment,
				'alignment_label'      => isset( $alignment_labels[ $alignment ] ) ? $alignment_labels[ $alignment ] : $alignment,
				'separator_type'       => $separator_selector,
				'separator_type_label' => isset( $separator_labels[ $separator_selector ] ) ? $separator_labels[ $separator_selector ] : $separator_selector,
				'separator_custom'     => $separator_custom,
				'enable_on'            => $enable_on,
				'typography'           => $typography,
				'colors'               => $colors,
				'spacing'              => $spacing,
				'available_positions'  => $position_labels,
				'available_alignments' => $alignment_labels,
				'available_separators' => $separator_labels,
			)
		);
	}


User Contributed Notes

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