From 0f5b424d23974e2dc7ddc03bf9668dd67bb0f645 Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" <41898282+github-actions[bot]@users.noreply.github.com> Date: Wed, 18 Dec 2024 16:41:12 -0500 Subject: [PATCH] Content updates from Page Editor (#531) * [automated] Sync content from Page Editor. * Remove the custom download modal * Parser: Set a parser for the `modal` block, strip newlines from attribute replacements --------- Co-authored-by: wordpress-org-automations[bot] <68366308+wordpress-org-automations[bot]@users.noreply.github.com> Co-authored-by: Kelly Dwan --- env/export-content/includes/parser.php | 1 + .../includes/parsers/BlockParser.php | 4 +- .../tests/block-parser-test.php | 9 ++ .../themes/wporg-main-2022/functions.php | 27 ----- .../wporg-main-2022/patterns/download.php | 55 +++++++--- .../download-modal/download-modal.js | 45 -------- .../src/components/download-modal/index.js | 39 ------- .../wporg-main-2022/src/download/block.json | 3 - .../wporg-main-2022/src/download/index.js | 19 ---- .../wporg-main-2022/src/download/style.scss | 101 ------------------ 10 files changed, 56 insertions(+), 247 deletions(-) delete mode 100644 source/wp-content/themes/wporg-main-2022/src/components/download-modal/download-modal.js delete mode 100644 source/wp-content/themes/wporg-main-2022/src/components/download-modal/index.js delete mode 100644 source/wp-content/themes/wporg-main-2022/src/download/block.json delete mode 100644 source/wp-content/themes/wporg-main-2022/src/download/index.js delete mode 100644 source/wp-content/themes/wporg-main-2022/src/download/style.scss diff --git a/env/export-content/includes/parser.php b/env/export-content/includes/parser.php index 26088f6d..5078a41f 100644 --- a/env/export-content/includes/parser.php +++ b/env/export-content/includes/parser.php @@ -54,6 +54,7 @@ public function __construct( string $content = '' ) { // Shared custom blocks. 'wporg/link-wrapper' => new Parsers\HTMLParser( 'a', [ 'href' ] ), + 'wporg/modal' => new Parsers\AttributeParser( [ 'label' ] ), ]; } diff --git a/env/export-content/includes/parsers/BlockParser.php b/env/export-content/includes/parsers/BlockParser.php index 6649681e..7d8d6cfd 100644 --- a/env/export-content/includes/parsers/BlockParser.php +++ b/env/export-content/includes/parsers/BlockParser.php @@ -61,7 +61,9 @@ private function get_attribute( string $attribute_name, array $block ) : array { private function set_attribute( string $attribute_name, array &$block, array $replacements ) { if ( isset( $block['attrs'][ $attribute_name ] ) && is_string( $block['attrs'][ $attribute_name ] ) ) { if ( isset( $replacements[ $block['attrs'][ $attribute_name ] ] ) ) { - $block['attrs'][ $attribute_name ] = $replacements[ $block['attrs'][ $attribute_name ] ]; + $replace = $replacements[ $block['attrs'][ $attribute_name ] ]; + $replace = str_replace( "\n", ' ', $replace ); + $block['attrs'][ $attribute_name ] = $replace; } } } diff --git a/env/export-content/tests/block-parser-test.php b/env/export-content/tests/block-parser-test.php index 8570c2d2..2ceaca19 100644 --- a/env/export-content/tests/block-parser-test.php +++ b/env/export-content/tests/block-parser-test.php @@ -80,6 +80,10 @@ public function data_block_content_strings() { "\n
CookieLogged-in Users Only?
welcome-{blog_id}No
showCommentsNo
\n", [ 'Cookie', 'Logged-in Users Only?', 'welcome-{blog_id}', 'No', 'showComments' ], ], + [ + "\n\n
\n

Howdy!

\n
\n\n", + [ 'Download WordPress [latest_version]', 'Howdy!' ], + ], ]; } @@ -178,6 +182,11 @@ public function data_block_content_i18n_with_shortcode() { "\n
\n\n
\n", "\n
\n
\n
\n", ], + [ + // Modal, with shortcode in the label (shortcode in attribute). + "\n\n
\n

Howdy!

\n
\n\n", + "\n\n
\n

\n
\n\n", + ], ]; } diff --git a/source/wp-content/themes/wporg-main-2022/functions.php b/source/wp-content/themes/wporg-main-2022/functions.php index 3f654cb4..2427c3c5 100644 --- a/source/wp-content/themes/wporg-main-2022/functions.php +++ b/source/wp-content/themes/wporg-main-2022/functions.php @@ -44,33 +44,6 @@ function enqueue_assets() { ); wp_style_add_data( 'wporg-main-2022-style', 'rtl', 'replace' ); - if ( is_page( 'download' ) ) { - $path = __DIR__ . '/build/download/index.js'; - $deps_path = __DIR__ . '/build/download/index.asset.php'; - $script_info = file_exists( $deps_path ) - ? require $deps_path - : array( - 'dependencies' => array(), - 'version' => filemtime( $path ), - ); - - wp_enqueue_script( - 'wporg-main-2022-download-script', - get_stylesheet_directory_uri() . '/build/download/index.js', - $script_info['dependencies'], - $script_info['version'], - true - ); - - wp_enqueue_style( - 'wporg-main-2022-download-style', - get_stylesheet_directory_uri() . '/build/download/style-index.css', - array(), - filemtime( __DIR__ . '/build/download/style-index.css' ) - ); - wp_style_add_data( 'wporg-main-2022-download-style', 'rtl', 'replace' ); - } - if ( is_page( 'stats' ) ) { // phpcs:ignore WordPress.WP.EnqueuedResourceParameters wp_enqueue_script( 'google-charts', 'https://www.gstatic.com/charts/loader.js', [], null, true ); diff --git a/source/wp-content/themes/wporg-main-2022/patterns/download.php b/source/wp-content/themes/wporg-main-2022/patterns/download.php index 232eea6d..572b20fb 100644 --- a/source/wp-content/themes/wporg-main-2022/patterns/download.php +++ b/source/wp-content/themes/wporg-main-2022/patterns/download.php @@ -28,20 +28,51 @@

- -
-
- + +
+ + + + + +
+

+ + + +
+

Get involved in WordPress ↗︎', 'wporg' ); ?>

+ + + +

Join a local WordPress meetup ↗︎', 'wporg' ); ?>

+ + + +

Attend a WordCamp ↗︎', 'wporg' ); ?>

+ - + +

Support WordPress and open source education ↗︎', 'wporg' ); ?>

+
+
+ + + + +
- +
+ - +

-
    +
    • @@ -134,7 +165,7 @@
      -