Astra_Global_Palette::format_global_palette( array $global_palette )

Format color palette data required to pass for Gutenberg palette.


Description


Parameters

$global_palette

(array) (Required) global palette data.


Return

(array)


Source

File: inc/class-astra-global-palette.php

	public function format_global_palette( $global_palette ) {
		$editor_palette = array();
		$labels         = self::get_palette_labels();

		if ( isset( $global_palette['palette'] ) ) {
			foreach ( $global_palette['palette'] as $key => $color ) {

				$label = 'Theme ' . $labels[ $key ];

				$editor_palette[] = array(
					'name'  => $label,
					'slug'  => str_replace( '--', '', self::get_css_variable_prefix() ) . $key,
					'color' => 'var(' . self::get_css_variable_prefix() . $key . ')',
				);
			}
		}
		return $editor_palette;
	}

Changelog

Changelog
Version Description
3.7.0 Introduced.


User Contributed Notes

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