@wordpress/block-library 8.3.9 → 8.3.11
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/build/navigation/edit/inner-blocks.js +1 -4
- package/build/navigation/edit/inner-blocks.js.map +1 -1
- package/build-module/navigation/edit/inner-blocks.js +1 -4
- package/build-module/navigation/edit/inner-blocks.js.map +1 -1
- package/package.json +2 -2
- package/src/comment-template/index.php +2 -1
- package/src/navigation/edit/inner-blocks.js +0 -3
- package/src/navigation-link/index.php +71 -1
|
@@ -26,10 +26,7 @@ var _placeholderPreview = _interopRequireDefault(require("./placeholder/placehol
|
|
|
26
26
|
*/
|
|
27
27
|
const ALLOWED_BLOCKS = ['core/navigation-link', 'core/search', 'core/social-links', 'core/page-list', 'core/spacer', 'core/home-link', 'core/site-title', 'core/site-logo', 'core/navigation-submenu'];
|
|
28
28
|
const DEFAULT_BLOCK = {
|
|
29
|
-
name: 'core/navigation-link'
|
|
30
|
-
attributes: {
|
|
31
|
-
type: 'page'
|
|
32
|
-
}
|
|
29
|
+
name: 'core/navigation-link'
|
|
33
30
|
};
|
|
34
31
|
|
|
35
32
|
function NavigationInnerBlocks(_ref) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["@wordpress/block-library/src/navigation/edit/inner-blocks.js"],"names":["ALLOWED_BLOCKS","DEFAULT_BLOCK","name","
|
|
1
|
+
{"version":3,"sources":["@wordpress/block-library/src/navigation/edit/inner-blocks.js"],"names":["ALLOWED_BLOCKS","DEFAULT_BLOCK","name","NavigationInnerBlocks","clientId","hasCustomPlaceholder","orientation","templateLock","isImmediateParentOfSelectedBlock","selectedBlockHasChildren","isSelected","select","getBlockCount","hasSelectedInnerBlock","getSelectedBlockClientId","blockEditorStore","selectedBlockId","blocks","onInput","onChange","shouldDirectInsert","every","parentOrChildHasSelection","placeholder","hasMenuItems","length","showPlaceholder","innerBlocksProps","className","value","allowedBlocks","__experimentalDefaultBlock","__experimentalD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,IAAI,KAAK,yBADT,IAEAA,IAAI,KAAK,gBAHV;AAAA,GADD,CAFyB,EAQ1B,CAAEe,MAAF,CAR0B,CAA3B,CAlCG,CA6CH;AACA;AACA;;AACA,QAAMK,yBAAyB,GAC9BZ,UAAU,IACRF,gCAAgC,IAAI,CAAEC,wBAFzC;AAIA,QAAMc,WAAW,GAAG,sBAAS,MAAM,4BAAC,2BAAD,OAAf,EAAuC,EAAvC,CAApB;AAEA,QAAMC,YAAY,GAAG,CAAC,EAAEP,MAAF,aAAEA,MAAF,eAAEA,MAAM,CAAEQ,MAAV,CAAtB,CAtDG,CAwDH;AACA;AACA;AACA;;AACA,QAAMC,eAAe,GACpB,CAAErB,oBAAF,IAA0B,CAAEmB,YAA5B,IAA4C,CAAEd,UAD/C;AAGA,QAAMiB,gBAAgB,GAAG,sCACxB;AACCC,IAAAA,SAAS,EAAE;AADZ,GADwB,EAIxB;AACCC,IAAAA,KAAK,EAAEZ,MADR;AAECC,IAAAA,OAFD;AAGCC,IAAAA,QAHD;AAICW,IAAAA,aAAa,EAAE9B,cAJhB;AAKC+B,IAAAA,0BAA0B,EAAE9B,aAL7B;AAMC+B,IAAAA,0BAA0B,EAAEZ,kBAN7B;AAOCd,IAAAA,WAPD;AAQCC,IAAAA,YARD;AAUC;AACA;AACA;AACA;AACA;AACA0B,IAAAA,cAAc,EACbvB,UAAU,IACRF,gCAAgC,IACjC,CAAEC,wBAFH,IAGA;AACAa,IAAAA,yBAJA,GAKGY,yBAAYC,mBALf,GAMG,KAtBL;AAuBCZ,IAAAA,WAAW,EAAEG,eAAe,GAAGH,WAAH,GAAiBa;AAvB9C,GAJwB,CAAzB;AA+BA,SAAO,mCAAUT,gBAAV,CAAP;AACA","sourcesContent":["/**\n * WordPress dependencies\n */\nimport { useEntityBlockEditor } from '@wordpress/core-data';\nimport {\n\tuseInnerBlocksProps,\n\tInnerBlocks,\n\tstore as blockEditorStore,\n} from '@wordpress/block-editor';\nimport { useSelect } from '@wordpress/data';\nimport { useMemo } from '@wordpress/element';\n\n/**\n * Internal dependencies\n */\nimport PlaceholderPreview from './placeholder/placeholder-preview';\n\nconst ALLOWED_BLOCKS = [\n\t'core/navigation-link',\n\t'core/search',\n\t'core/social-links',\n\t'core/page-list',\n\t'core/spacer',\n\t'core/home-link',\n\t'core/site-title',\n\t'core/site-logo',\n\t'core/navigation-submenu',\n];\n\nconst DEFAULT_BLOCK = {\n\tname: 'core/navigation-link',\n};\n\nexport default function NavigationInnerBlocks( {\n\tclientId,\n\thasCustomPlaceholder,\n\torientation,\n\ttemplateLock,\n} ) {\n\tconst {\n\t\tisImmediateParentOfSelectedBlock,\n\t\tselectedBlockHasChildren,\n\t\tisSelected,\n\t} = useSelect(\n\t\t( select ) => {\n\t\t\tconst {\n\t\t\t\tgetBlockCount,\n\t\t\t\thasSelectedInnerBlock,\n\t\t\t\tgetSelectedBlockClientId,\n\t\t\t} = select( blockEditorStore );\n\t\t\tconst selectedBlockId = getSelectedBlockClientId();\n\n\t\t\treturn {\n\t\t\t\tisImmediateParentOfSelectedBlock: hasSelectedInnerBlock(\n\t\t\t\t\tclientId,\n\t\t\t\t\tfalse\n\t\t\t\t),\n\t\t\t\tselectedBlockHasChildren: !! getBlockCount( selectedBlockId ),\n\n\t\t\t\t// This prop is already available but computing it here ensures it's\n\t\t\t\t// fresh compared to isImmediateParentOfSelectedBlock.\n\t\t\t\tisSelected: selectedBlockId === clientId,\n\t\t\t};\n\t\t},\n\t\t[ clientId ]\n\t);\n\n\tconst [ blocks, onInput, onChange ] = useEntityBlockEditor(\n\t\t'postType',\n\t\t'wp_navigation'\n\t);\n\n\tconst shouldDirectInsert = useMemo(\n\t\t() =>\n\t\t\tblocks.every(\n\t\t\t\t( { name } ) =>\n\t\t\t\t\tname === 'core/navigation-link' ||\n\t\t\t\t\tname === 'core/navigation-submenu' ||\n\t\t\t\t\tname === 'core/page-list'\n\t\t\t),\n\t\t[ blocks ]\n\t);\n\n\t// When the block is selected itself or has a top level item selected that\n\t// doesn't itself have children, show the standard appender. Else show no\n\t// appender.\n\tconst parentOrChildHasSelection =\n\t\tisSelected ||\n\t\t( isImmediateParentOfSelectedBlock && ! selectedBlockHasChildren );\n\n\tconst placeholder = useMemo( () => <PlaceholderPreview />, [] );\n\n\tconst hasMenuItems = !! blocks?.length;\n\n\t// If there is a `ref` attribute pointing to a `wp_navigation` but\n\t// that menu has no **items** (i.e. empty) then show a placeholder.\n\t// The block must also be selected else the placeholder will display\n\t// alongside the appender.\n\tconst showPlaceholder =\n\t\t! hasCustomPlaceholder && ! hasMenuItems && ! isSelected;\n\n\tconst innerBlocksProps = useInnerBlocksProps(\n\t\t{\n\t\t\tclassName: 'wp-block-navigation__container',\n\t\t},\n\t\t{\n\t\t\tvalue: blocks,\n\t\t\tonInput,\n\t\t\tonChange,\n\t\t\tallowedBlocks: ALLOWED_BLOCKS,\n\t\t\t__experimentalDefaultBlock: DEFAULT_BLOCK,\n\t\t\t__experimentalDirectInsert: shouldDirectInsert,\n\t\t\torientation,\n\t\t\ttemplateLock,\n\n\t\t\t// As an exception to other blocks which feature nesting, show\n\t\t\t// the block appender even when a child block is selected.\n\t\t\t// This should be a temporary fix, to be replaced by improvements to\n\t\t\t// the sibling inserter.\n\t\t\t// See https://github.com/WordPress/gutenberg/issues/37572.\n\t\t\trenderAppender:\n\t\t\t\tisSelected ||\n\t\t\t\t( isImmediateParentOfSelectedBlock &&\n\t\t\t\t\t! selectedBlockHasChildren ) ||\n\t\t\t\t// Show the appender while dragging to allow inserting element between item and the appender.\n\t\t\t\tparentOrChildHasSelection\n\t\t\t\t\t? InnerBlocks.ButtonBlockAppender\n\t\t\t\t\t: false,\n\t\t\tplaceholder: showPlaceholder ? placeholder : undefined,\n\t\t}\n\t);\n\n\treturn <div { ...innerBlocksProps } />;\n}\n"]}
|
|
@@ -14,10 +14,7 @@ import { useMemo } from '@wordpress/element';
|
|
|
14
14
|
import PlaceholderPreview from './placeholder/placeholder-preview';
|
|
15
15
|
const ALLOWED_BLOCKS = ['core/navigation-link', 'core/search', 'core/social-links', 'core/page-list', 'core/spacer', 'core/home-link', 'core/site-title', 'core/site-logo', 'core/navigation-submenu'];
|
|
16
16
|
const DEFAULT_BLOCK = {
|
|
17
|
-
name: 'core/navigation-link'
|
|
18
|
-
attributes: {
|
|
19
|
-
type: 'page'
|
|
20
|
-
}
|
|
17
|
+
name: 'core/navigation-link'
|
|
21
18
|
};
|
|
22
19
|
export default function NavigationInnerBlocks(_ref) {
|
|
23
20
|
let {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["@wordpress/block-library/src/navigation/edit/inner-blocks.js"],"names":["useEntityBlockEditor","useInnerBlocksProps","InnerBlocks","store","blockEditorStore","useSelect","useMemo","PlaceholderPreview","ALLOWED_BLOCKS","DEFAULT_BLOCK","name","
|
|
1
|
+
{"version":3,"sources":["@wordpress/block-library/src/navigation/edit/inner-blocks.js"],"names":["useEntityBlockEditor","useInnerBlocksProps","InnerBlocks","store","blockEditorStore","useSelect","useMemo","PlaceholderPreview","ALLOWED_BLOCKS","DEFAULT_BLOCK","name","NavigationInnerBlocks","clientId","hasCustomPlaceholder","orientation","templateLock","isImmediateParentOfSelectedBlock","selectedBlockHasChildren","isSelected","select","getBlockCount","hasSelectedInnerBlock","getSelectedBlockClientId","selectedBlockId","blocks","onInput","onChange","shouldDirectInsert","every","parentOrChildHasSelection","placeholder","hasMenuItems","length","showPlaceholder","innerBlocksProps","className","value","allowedBlocks","__experimentalDefaultBlock","__experimentalDirectInsert","renderAppender","ButtonBlockAppender","undefined"],"mappings":";;AAAA;AACA;AACA;AACA,SAASA,oBAAT,QAAqC,sBAArC;AACA,SACCC,mBADD,EAECC,WAFD,EAGCC,KAAK,IAAIC,gBAHV,QAIO,yBAJP;AAKA,SAASC,SAAT,QAA0B,iBAA1B;AACA,SAASC,OAAT,QAAwB,oBAAxB;AAEA;AACA;AACA;;AACA,OAAOC,kBAAP,MAA+B,mCAA/B;AAEA,MAAMC,cAAc,GAA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;AACA,QAAMK,yBAAyB,GAC9BX,UAAU,IACRF,gCAAgC,IAAI,CAAEC,wBAFzC;AAIA,QAAMa,WAAW,GAAGxB,OAAO,CAAE,MAAM,cAAC,kBAAD,OAAR,EAAgC,EAAhC,CAA3B;AAEA,QAAMyB,YAAY,GAAG,CAAC,EAAEP,MAAF,aAAEA,MAAF,eAAEA,MAAM,CAAEQ,MAAV,CAAtB,CAtDG,CAwDH;AACA;AACA;AACA;;AACA,QAAMC,eAAe,GACpB,CAAEpB,oBAAF,IAA0B,CAAEkB,YAA5B,IAA4C,CAAEb,UAD/C;AAGA,QAAMgB,gBAAgB,GAAGjC,mBAAmB,CAC3C;AACCkC,IAAAA,SAAS,EAAE;AADZ,GAD2C,EAI3C;AACCC,IAAAA,KAAK,EAAEZ,MADR;AAECC,IAAAA,OAFD;AAGCC,IAAAA,QAHD;AAICW,IAAAA,aAAa,EAAE7B,cAJhB;AAKC8B,IAAAA,0BAA0B,EAAE7B,aAL7B;AAMC8B,IAAAA,0BAA0B,EAAEZ,kBAN7B;AAOCb,IAAAA,WAPD;AAQCC,IAAAA,YARD;AAUC;AACA;AACA;AACA;AACA;AACAyB,IAAAA,cAAc,EACbtB,UAAU,IACRF,gCAAgC,IACjC,CAAEC,wBAFH,IAGA;AACAY,IAAAA,yBAJA,GAKG3B,WAAW,CAACuC,mBALf,GAMG,KAtBL;AAuBCX,IAAAA,WAAW,EAAEG,eAAe,GAAGH,WAAH,GAAiBY;AAvB9C,GAJ2C,CAA5C;AA+BA,SAAO,qBAAUR,gBAAV,CAAP;AACA","sourcesContent":["/**\n * WordPress dependencies\n */\nimport { useEntityBlockEditor } from '@wordpress/core-data';\nimport {\n\tuseInnerBlocksProps,\n\tInnerBlocks,\n\tstore as blockEditorStore,\n} from '@wordpress/block-editor';\nimport { useSelect } from '@wordpress/data';\nimport { useMemo } from '@wordpress/element';\n\n/**\n * Internal dependencies\n */\nimport PlaceholderPreview from './placeholder/placeholder-preview';\n\nconst ALLOWED_BLOCKS = [\n\t'core/navigation-link',\n\t'core/search',\n\t'core/social-links',\n\t'core/page-list',\n\t'core/spacer',\n\t'core/home-link',\n\t'core/site-title',\n\t'core/site-logo',\n\t'core/navigation-submenu',\n];\n\nconst DEFAULT_BLOCK = {\n\tname: 'core/navigation-link',\n};\n\nexport default function NavigationInnerBlocks( {\n\tclientId,\n\thasCustomPlaceholder,\n\torientation,\n\ttemplateLock,\n} ) {\n\tconst {\n\t\tisImmediateParentOfSelectedBlock,\n\t\tselectedBlockHasChildren,\n\t\tisSelected,\n\t} = useSelect(\n\t\t( select ) => {\n\t\t\tconst {\n\t\t\t\tgetBlockCount,\n\t\t\t\thasSelectedInnerBlock,\n\t\t\t\tgetSelectedBlockClientId,\n\t\t\t} = select( blockEditorStore );\n\t\t\tconst selectedBlockId = getSelectedBlockClientId();\n\n\t\t\treturn {\n\t\t\t\tisImmediateParentOfSelectedBlock: hasSelectedInnerBlock(\n\t\t\t\t\tclientId,\n\t\t\t\t\tfalse\n\t\t\t\t),\n\t\t\t\tselectedBlockHasChildren: !! getBlockCount( selectedBlockId ),\n\n\t\t\t\t// This prop is already available but computing it here ensures it's\n\t\t\t\t// fresh compared to isImmediateParentOfSelectedBlock.\n\t\t\t\tisSelected: selectedBlockId === clientId,\n\t\t\t};\n\t\t},\n\t\t[ clientId ]\n\t);\n\n\tconst [ blocks, onInput, onChange ] = useEntityBlockEditor(\n\t\t'postType',\n\t\t'wp_navigation'\n\t);\n\n\tconst shouldDirectInsert = useMemo(\n\t\t() =>\n\t\t\tblocks.every(\n\t\t\t\t( { name } ) =>\n\t\t\t\t\tname === 'core/navigation-link' ||\n\t\t\t\t\tname === 'core/navigation-submenu' ||\n\t\t\t\t\tname === 'core/page-list'\n\t\t\t),\n\t\t[ blocks ]\n\t);\n\n\t// When the block is selected itself or has a top level item selected that\n\t// doesn't itself have children, show the standard appender. Else show no\n\t// appender.\n\tconst parentOrChildHasSelection =\n\t\tisSelected ||\n\t\t( isImmediateParentOfSelectedBlock && ! selectedBlockHasChildren );\n\n\tconst placeholder = useMemo( () => <PlaceholderPreview />, [] );\n\n\tconst hasMenuItems = !! blocks?.length;\n\n\t// If there is a `ref` attribute pointing to a `wp_navigation` but\n\t// that menu has no **items** (i.e. empty) then show a placeholder.\n\t// The block must also be selected else the placeholder will display\n\t// alongside the appender.\n\tconst showPlaceholder =\n\t\t! hasCustomPlaceholder && ! hasMenuItems && ! isSelected;\n\n\tconst innerBlocksProps = useInnerBlocksProps(\n\t\t{\n\t\t\tclassName: 'wp-block-navigation__container',\n\t\t},\n\t\t{\n\t\t\tvalue: blocks,\n\t\t\tonInput,\n\t\t\tonChange,\n\t\t\tallowedBlocks: ALLOWED_BLOCKS,\n\t\t\t__experimentalDefaultBlock: DEFAULT_BLOCK,\n\t\t\t__experimentalDirectInsert: shouldDirectInsert,\n\t\t\torientation,\n\t\t\ttemplateLock,\n\n\t\t\t// As an exception to other blocks which feature nesting, show\n\t\t\t// the block appender even when a child block is selected.\n\t\t\t// This should be a temporary fix, to be replaced by improvements to\n\t\t\t// the sibling inserter.\n\t\t\t// See https://github.com/WordPress/gutenberg/issues/37572.\n\t\t\trenderAppender:\n\t\t\t\tisSelected ||\n\t\t\t\t( isImmediateParentOfSelectedBlock &&\n\t\t\t\t\t! selectedBlockHasChildren ) ||\n\t\t\t\t// Show the appender while dragging to allow inserting element between item and the appender.\n\t\t\t\tparentOrChildHasSelection\n\t\t\t\t\t? InnerBlocks.ButtonBlockAppender\n\t\t\t\t\t: false,\n\t\t\tplaceholder: showPlaceholder ? placeholder : undefined,\n\t\t}\n\t);\n\n\treturn <div { ...innerBlocksProps } />;\n}\n"]}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@wordpress/block-library",
|
|
3
|
-
"version": "8.3.
|
|
3
|
+
"version": "8.3.11",
|
|
4
4
|
"description": "Block library for the WordPress editor.",
|
|
5
5
|
"author": "The WordPress Contributors",
|
|
6
6
|
"license": "GPL-2.0-or-later",
|
|
@@ -77,5 +77,5 @@
|
|
|
77
77
|
"publishConfig": {
|
|
78
78
|
"access": "public"
|
|
79
79
|
},
|
|
80
|
-
"gitHead": "
|
|
80
|
+
"gitHead": "811da1ab3a91aacd078e71f486e1393e13f72506"
|
|
81
81
|
}
|
|
@@ -58,10 +58,11 @@ function block_core_comment_template_render_comments( $comments, $block ) {
|
|
|
58
58
|
$block_content .= sprintf( '<ol>%1$s</ol>', $inner_content );
|
|
59
59
|
--$comment_depth;
|
|
60
60
|
} else {
|
|
61
|
-
$
|
|
61
|
+
$inner_content = block_core_comment_template_render_comments(
|
|
62
62
|
$children,
|
|
63
63
|
$block
|
|
64
64
|
);
|
|
65
|
+
$block_content .= sprintf( $inner_content );
|
|
65
66
|
}
|
|
66
67
|
}
|
|
67
68
|
|
|
@@ -5,6 +5,76 @@
|
|
|
5
5
|
* @package WordPress
|
|
6
6
|
*/
|
|
7
7
|
|
|
8
|
+
/**
|
|
9
|
+
* Build an array with CSS classes and inline styles defining the colors
|
|
10
|
+
* which will be applied to the navigation markup in the front-end.
|
|
11
|
+
*
|
|
12
|
+
* @param array $context Navigation block context.
|
|
13
|
+
* @param array $attributes Block attributes.
|
|
14
|
+
* @param bool $is_sub_menu Whether the link is part of a sub-menu.
|
|
15
|
+
* @return array Colors CSS classes and inline styles.
|
|
16
|
+
*/
|
|
17
|
+
function block_core_navigation_link_build_css_colors( $context, $attributes, $is_sub_menu = false ) {
|
|
18
|
+
$colors = array(
|
|
19
|
+
'css_classes' => array(),
|
|
20
|
+
'inline_styles' => '',
|
|
21
|
+
);
|
|
22
|
+
|
|
23
|
+
// Text color.
|
|
24
|
+
$named_text_color = null;
|
|
25
|
+
$custom_text_color = null;
|
|
26
|
+
|
|
27
|
+
if ( $is_sub_menu && array_key_exists( 'customOverlayTextColor', $context ) ) {
|
|
28
|
+
$custom_text_color = $context['customOverlayTextColor'];
|
|
29
|
+
} elseif ( $is_sub_menu && array_key_exists( 'overlayTextColor', $context ) ) {
|
|
30
|
+
$named_text_color = $context['overlayTextColor'];
|
|
31
|
+
} elseif ( array_key_exists( 'customTextColor', $context ) ) {
|
|
32
|
+
$custom_text_color = $context['customTextColor'];
|
|
33
|
+
} elseif ( array_key_exists( 'textColor', $context ) ) {
|
|
34
|
+
$named_text_color = $context['textColor'];
|
|
35
|
+
} elseif ( isset( $context['style']['color']['text'] ) ) {
|
|
36
|
+
$custom_text_color = $context['style']['color']['text'];
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
// If has text color.
|
|
40
|
+
if ( ! is_null( $named_text_color ) ) {
|
|
41
|
+
// Add the color class.
|
|
42
|
+
array_push( $colors['css_classes'], 'has-text-color', sprintf( 'has-%s-color', $named_text_color ) );
|
|
43
|
+
} elseif ( ! is_null( $custom_text_color ) ) {
|
|
44
|
+
// Add the custom color inline style.
|
|
45
|
+
$colors['css_classes'][] = 'has-text-color';
|
|
46
|
+
$colors['inline_styles'] .= sprintf( 'color: %s;', $custom_text_color );
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
// Background color.
|
|
50
|
+
$named_background_color = null;
|
|
51
|
+
$custom_background_color = null;
|
|
52
|
+
|
|
53
|
+
if ( $is_sub_menu && array_key_exists( 'customOverlayBackgroundColor', $context ) ) {
|
|
54
|
+
$custom_background_color = $context['customOverlayBackgroundColor'];
|
|
55
|
+
} elseif ( $is_sub_menu && array_key_exists( 'overlayBackgroundColor', $context ) ) {
|
|
56
|
+
$named_background_color = $context['overlayBackgroundColor'];
|
|
57
|
+
} elseif ( array_key_exists( 'customBackgroundColor', $context ) ) {
|
|
58
|
+
$custom_background_color = $context['customBackgroundColor'];
|
|
59
|
+
} elseif ( array_key_exists( 'backgroundColor', $context ) ) {
|
|
60
|
+
$named_background_color = $context['backgroundColor'];
|
|
61
|
+
} elseif ( isset( $context['style']['color']['background'] ) ) {
|
|
62
|
+
$custom_background_color = $context['style']['color']['background'];
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
// If has background color.
|
|
66
|
+
if ( ! is_null( $named_background_color ) ) {
|
|
67
|
+
// Add the background-color class.
|
|
68
|
+
array_push( $colors['css_classes'], 'has-background', sprintf( 'has-%s-background-color', $named_background_color ) );
|
|
69
|
+
} elseif ( ! is_null( $custom_background_color ) ) {
|
|
70
|
+
// Add the custom background-color inline style.
|
|
71
|
+
$colors['css_classes'][] = 'has-background';
|
|
72
|
+
$colors['inline_styles'] .= sprintf( 'background-color: %s;', $custom_background_color );
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
return $colors;
|
|
76
|
+
}
|
|
77
|
+
|
|
8
78
|
/**
|
|
9
79
|
* Build an array with CSS classes and inline styles defining the font sizes
|
|
10
80
|
* which will be applied to the navigation markup in the front-end.
|
|
@@ -107,7 +177,7 @@ function render_block_core_navigation_link( $attributes, $content, $block ) {
|
|
|
107
177
|
$classes = array_merge(
|
|
108
178
|
$font_sizes['css_classes']
|
|
109
179
|
);
|
|
110
|
-
$style_attribute =
|
|
180
|
+
$style_attribute = $font_sizes['inline_styles'];
|
|
111
181
|
|
|
112
182
|
$css_classes = trim( implode( ' ', $classes ) );
|
|
113
183
|
$has_submenu = count( $block->inner_blocks ) > 0;
|