@@ -230,7 +230,7 @@ public function get_attributes() {
230230 'default ' => $ this ->get_default_value ( 'paginate_label_next ' ),
231231 ),
232232
233- // get_supports() color attribute .
233+ // get_supports() style, color and typography attributes .
234234 'style ' => array (
235235 'type ' => 'object ' ,
236236 ),
@@ -240,6 +240,9 @@ public function get_attributes() {
240240 'textColor ' => array (
241241 'type ' => 'string ' ,
242242 ),
243+ 'fontSize ' => array (
244+ 'type ' => 'string ' ,
245+ ),
243246
244247 // Always required for Gutenberg.
245248 'is_gutenberg_example ' => array (
@@ -260,12 +263,20 @@ public function get_attributes() {
260263 public function get_supports () {
261264
262265 return array (
263- 'className ' => true ,
264- 'color ' => array (
266+ 'className ' => true ,
267+ 'color ' => array (
265268 'link ' => true ,
266269 'background ' => true ,
267270 'text ' => true ,
268271 ),
272+ 'typography ' => array (
273+ 'fontSize ' => true ,
274+ 'lineHeight ' => true ,
275+ ),
276+ 'spacing ' => array (
277+ 'margin ' => true ,
278+ 'padding ' => true ,
279+ ),
269280 );
270281
271282 }
@@ -455,8 +466,8 @@ public function get_default_values() {
455466 *
456467 * @since 1.9.7.4
457468 *
458- * @param array $atts Block / Shortcode Attributes.
459- * @return string Output
469+ * @param array $atts Block / Shortcode / Page Builder Module Attributes.
470+ * @return string
460471 */
461472 public function render ( $ atts ) {
462473
@@ -487,15 +498,21 @@ public function render( $atts ) {
487498 }
488499
489500 // Build HTML.
490- $ html = $ this ->build_html ( $ posts , $ atts );
501+ $ html = $ this ->build_html (
502+ $ posts ,
503+ $ atts ,
504+ ! $ this ->is_block_editor_request (),
505+ $ this ->get_css_classes (),
506+ $ this ->get_css_styles ( $ atts )
507+ );
491508
492509 /**
493510 * Filter the block's content immediately before it is output.
494511 *
495512 * @since 1.9.7.4
496513 *
497- * @param string $html ConvertKit Broadcasts HTML.
498- * @param array $atts Block Attributes.
514+ * @param string $html ConvertKit Broadcasts HTML.
515+ * @param array $atts Block Attributes.
499516 */
500517 $ html = apply_filters ( 'convertkit_block_broadcasts_render ' , $ html , $ atts );
501518
@@ -564,9 +581,11 @@ public function render_ajax() {
564581 * @param ConvertKit_Resource_Posts $posts ConvertKit Posts Resource class.
565582 * @param array $atts Block attributes.
566583 * @param bool $include_container Include container div in HTML.
567- * @return string HTML
584+ * @param array $css_classes CSS classes to apply to block.
585+ * @param array $css_styles CSS inline styles to apply to block.
586+ * @return string
568587 */
569- private function build_html ( $ posts , $ atts , $ include_container = true ) {
588+ private function build_html ( $ posts , $ atts , $ include_container = true , $ css_classes = array (), $ css_styles = array () ) {
570589
571590 // Get paginated subset of Posts.
572591 $ broadcasts = $ posts ->get_paginated_subset ( $ atts ['page ' ], $ atts ['limit ' ] );
@@ -579,7 +598,7 @@ private function build_html( $posts, $atts, $include_container = true ) {
579598
580599 // Include container, if required.
581600 if ( $ include_container ) {
582- $ html .= '<div class=" ' . implode ( ' ' , map_deep ( $ atts [ ' _css_classes ' ] , 'sanitize_html_class ' ) ) . '" style=" ' . implode ( '; ' , map_deep ( $ atts [ ' _css_styles ' ] , 'esc_attr ' ) ) . '" ' . $ this ->get_atts_as_html_data_attributes ( $ atts ) . '> ' ;
601+ $ html .= '<div class=" ' . implode ( ' ' , map_deep ( $ css_classes , 'sanitize_html_class ' ) ) . '" style=" ' . implode ( '; ' , map_deep ( $ css_styles , 'esc_attr ' ) ) . '" ' . $ this ->get_atts_as_html_data_attributes ( $ atts ) . '> ' ;
583602 }
584603
585604 // Start list.
0 commit comments