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
Download WordPress [latest_version]
\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 @@
      -