From df0af6afd79b9c75aba48e42db914a46d506dee7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?So=CC=88ren=20Wrede?= Date: Tue, 29 Jan 2019 12:41:34 +0100 Subject: [PATCH 1/5] support custom className --- packages/block-library/src/rss/index.php | 27 +++++++++++++----------- 1 file changed, 15 insertions(+), 12 deletions(-) diff --git a/packages/block-library/src/rss/index.php b/packages/block-library/src/rss/index.php index b5fe3abaf563be..23afa65713f0a1 100644 --- a/packages/block-library/src/rss/index.php +++ b/packages/block-library/src/rss/index.php @@ -96,31 +96,26 @@ function register_block_core_rss() { register_block_type( 'core/rss', array( 'attributes' => array( - 'columns' => array( - 'type' => 'number', - 'default' => 2, - ), 'blockLayout' => array( 'type' => 'string', 'default' => 'list', ), - 'feedURL' => array( - 'type' => 'string', - 'default' => '', + 'className' => array( + 'type' => 'string', ), - 'itemsToShow' => array( + 'columns' => array( 'type' => 'number', - 'default' => 5, + 'default' => 2, ), - 'displayExcerpt' => array( + 'displayAuthor' => array( 'type' => 'boolean', 'default' => false, ), - 'displayAuthor' => array( + 'displayDate' => array( 'type' => 'boolean', 'default' => false, ), - 'displayDate' => array( + 'displayExcerpt' => array( 'type' => 'boolean', 'default' => false, ), @@ -128,6 +123,14 @@ function register_block_core_rss() { 'type' => 'number', 'default' => 55, ), + 'feedURL' => array( + 'type' => 'string', + 'default' => '', + ), + 'itemsToShow' => array( + 'type' => 'number', + 'default' => 5, + ), ), 'render_callback' => 'render_block_core_rss', ) From ae499a456b70283bc010dc08bfbb82f3ba7a5caf Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?So=CC=88ren=20Wrede?= Date: Tue, 29 Jan 2019 12:47:53 +0100 Subject: [PATCH 2/5] display className --- packages/block-library/src/rss/index.php | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/packages/block-library/src/rss/index.php b/packages/block-library/src/rss/index.php index 23afa65713f0a1..e56f9f55cf13b1 100644 --- a/packages/block-library/src/rss/index.php +++ b/packages/block-library/src/rss/index.php @@ -79,7 +79,12 @@ function render_block_core_rss( $attributes ) { $list_items .= "
  • {$title}{$date}{$author}{$excerpt}
  • "; } - $classes = 'grid' === $attributes['blockLayout'] ? ' is-grid columns-' . $attributes['columns'] : ''; + $classes = 'grid' === $attributes['blockLayout'] ? ' is-grid columns-' . $attributes['columns'] : ''; + + if ( isset( $attributes['className'] ) ) { + $classes .= ' ' . $attributes['className']; + } + $list_items_markup = ""; // PHP 5.2 compatibility. See: http://simplepie.org/wiki/faq/i_m_getting_memory_leaks. From ec01a316a7db4d40dba587bb5a5edc6024f3133c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?So=CC=88ren=20Wrede?= Date: Tue, 29 Jan 2019 13:00:36 +0100 Subject: [PATCH 3/5] classes --- packages/block-library/src/rss/index.php | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/packages/block-library/src/rss/index.php b/packages/block-library/src/rss/index.php index e56f9f55cf13b1..bc09c715719510 100644 --- a/packages/block-library/src/rss/index.php +++ b/packages/block-library/src/rss/index.php @@ -79,13 +79,17 @@ function render_block_core_rss( $attributes ) { $list_items .= "
  • {$title}{$date}{$author}{$excerpt}
  • "; } - $classes = 'grid' === $attributes['blockLayout'] ? ' is-grid columns-' . $attributes['columns'] : ''; + $class = 'wp-block-rss'; + + if ( 'grid' === $attributes['blockLayout'] ) { + $class .= ' is-grid columns-' . $attributes['columns']; + } if ( isset( $attributes['className'] ) ) { - $classes .= ' ' . $attributes['className']; + $class .= ' ' . $attributes['className']; } - $list_items_markup = "
      {$list_items}
    "; + $list_items_markup = "
      {$list_items}
    "; // PHP 5.2 compatibility. See: http://simplepie.org/wiki/faq/i_m_getting_memory_leaks. $rss->__destruct(); From 8ba8d5b77cfbffb02ca0fb1a8b6c33909c3c5b08 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?So=CC=88ren=20Wrede?= Date: Tue, 29 Jan 2019 13:06:38 +0100 Subject: [PATCH 4/5] use tabs --- packages/block-library/src/rss/index.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/block-library/src/rss/index.php b/packages/block-library/src/rss/index.php index bc09c715719510..48cbf754aa1155 100644 --- a/packages/block-library/src/rss/index.php +++ b/packages/block-library/src/rss/index.php @@ -79,7 +79,7 @@ function render_block_core_rss( $attributes ) { $list_items .= "
  • {$title}{$date}{$author}{$excerpt}
  • "; } - $class = 'wp-block-rss'; + $class = 'wp-block-rss'; if ( 'grid' === $attributes['blockLayout'] ) { $class .= ' is-grid columns-' . $attributes['columns']; From cc996f5793ac90021a3f68ea5cfd9b5a2ad2d5d8 Mon Sep 17 00:00:00 2001 From: Robert Anderson Date: Mon, 18 Mar 2019 12:29:36 +0100 Subject: [PATCH 5/5] Update packages/block-library/src/rss/index.php Co-Authored-By: Soean --- packages/block-library/src/rss/index.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/block-library/src/rss/index.php b/packages/block-library/src/rss/index.php index 48cbf754aa1155..006cffcb081c22 100644 --- a/packages/block-library/src/rss/index.php +++ b/packages/block-library/src/rss/index.php @@ -85,7 +85,7 @@ function render_block_core_rss( $attributes ) { $class .= ' is-grid columns-' . $attributes['columns']; } - if ( isset( $attributes['className'] ) ) { + if ( ! empty( $attributes['className'] ) ) { $class .= ' ' . $attributes['className']; }