Astra_Ext_LifterLMS_Loader::register_builder_fields( string $default_fields )

Register theme postmeta fields with the LifterLMS Builder


Description


Parameters

$default_fields

(string) (Required) Default custom field definitions.


Return

(string) $default_fields Updated custom field definitions.


Source

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

		public function register_builder_fields( $default_fields ) {

			$disable_fields      = array();
			$addon_fields        = array();
			$show_meta_field     = ! Astra_Meta_Boxes::is_bb_themer_layout();
			$above_header_layout = astra_get_option( 'above-header-layout' );
			$below_header_layout = astra_get_option( 'below-header-layout' );

			$header_options = Astra_Target_Rules_Fields::get_post_selection( 'astra_adv_header' );

			foreach ( $header_options as $key => $value ) {
				$page_headers[ $key ] = $value;
			}

			if ( empty( $header_options ) ) {
				$page_headers = array(
					'' => __( 'No Page Headers Found', 'astra-addon' ),
				);
			}

			if ( Astra_Ext_Extension::is_active( 'sticky-header' ) ) {
				if ( $show_meta_field ) {
					$disable_fields[] = array(
						'attribute'  => 'header-main-stick-meta',
						'id'         => 'header-main-stick-meta',
						'label'      => esc_html__( 'Stick Primary Header', 'astra-addon' ),
						'switch_on'  => 'on',
						'switch_off' => 'off',
						'type'       => 'switch',
					);
				}
			}

			if ( Astra_Ext_Extension::is_active( 'sticky-header' ) ) {
				if ( $show_meta_field ) {
					$disable_fields[] = array(
						'attribute'  => 'header-above-stick-meta',
						'id'         => 'header-above-stick-meta',
						'label'      => esc_html__( 'Stick Above Header', 'astra-addon' ),
						'switch_on'  => 'on',
						'switch_off' => 'off',
						'type'       => 'switch',
					);
				}
			}

			if ( Astra_Ext_Extension::is_active( 'sticky-header' ) ) {
				if ( $show_meta_field ) {
					$disable_fields[] = array(
						'attribute'  => 'header-below-stick-meta',
						'id'         => 'header-below-stick-meta',
						'label'      => esc_html__( 'Stick Below Header', 'astra-addon' ),
						'switch_on'  => 'on',
						'switch_off' => 'off',
						'type'       => 'switch',
					);
				}
			}

			if ( 'disabled' !== $above_header_layout ) {
				if ( $show_meta_field ) {
					$disable_fields[] = array(
						'attribute' => 'ast-above-header-display',
						'id'        => 'ast-above-header-display',
						'label'     => esc_html__( 'Disable Above Header', 'astra-addon' ),
						'switch_on' => 'disabled',
						'type'      => 'switch',
					);
				}
			}

			if ( 'disabled' !== $below_header_layout ) {
				if ( $show_meta_field ) {
					$disable_fields[] = array(
						'attribute' => 'ast-below-header-display',
						'id'        => 'ast-below-header-display',
						'label'     => esc_html__( 'Disable Below Header', 'astra-addon' ),
						'switch_on' => 'disabled',
						'type'      => 'switch',
					);
				}
			}

			if ( Astra_Ext_Extension::is_active( 'advanced-headers' ) ) {
				$addon_fields[] = array(
					'attribute' => 'adv-header-id-meta',
					'id'        => 'adv-header-id-meta',
					'label'     => esc_html__( 'Page Header ', 'astra-addon' ),
					'type'      => 'ast-select',
					'options'   => $page_headers,
				);
			}

			if ( Astra_Ext_Extension::is_active( 'sticky-header' ) ) {
				$addon_fields[] = array(
					'attribute' => 'stick-header-meta',
					'id'        => 'stick-header-meta',
					'label'     => esc_html__( 'Sticky Header ', 'astra-addon' ),
					'type'      => 'ast-select',
					'options'   => array(
						'default'  => esc_html__( 'Customizer Setting', 'astra-addon' ),
						'enabled'  => esc_html__( 'Enabled', 'astra-addon' ),
						'disabled' => esc_html__( 'Disabled', 'astra-addon' ),
					),
				);
			}

			if ( Astra_Ext_Extension::is_active( 'transparent-header' ) ) {
				$addon_fields[] = array(
					'attribute' => 'theme-transparent-header-meta',
					'id'        => 'theme-transparent-header-meta',
					'label'     => esc_html__( 'Transparent Header ', 'astra-addon' ),
					'type'      => 'ast-select',
					'options'   => array(
						'default'  => esc_html__( 'Customizer Setting', 'astra-addon' ),
						'enabled'  => esc_html__( 'Enabled', 'astra-addon' ),
						'disabled' => esc_html__( 'Disabled', 'astra-addon' ),
					),
				);
			}

			$default_fields[] = $addon_fields;
			$default_fields[] = $disable_fields;

			return $default_fields;
		}

Changelog

Changelog
Version Description
[version] Introduced.


User Contributed Notes

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