Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 1 addition & 2 deletions src/next-events/block.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,7 @@
"example": {},
"attributes": {
"title": {
"type": "string",
"default": ""
"type": "string"
},
"tag": {
"type": "array"
Expand Down
9 changes: 4 additions & 5 deletions src/next-events/edit.js
Original file line number Diff line number Diff line change
Expand Up @@ -113,11 +113,10 @@ export default function Edit( { attributes, setAttributes } ) {
'Heading displayed above the events list',
'sunflower-next-events'
) }
value={ title }
placeholder={ __(
'Next events',
'sunflower-next-events'
) }
value={
title ??
__( 'Next events', 'sunflower-next-events' )
}
onChange={ onChangeTitle }
/>
<RangeControl
Expand Down
7 changes: 4 additions & 3 deletions src/next-events/render.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,8 @@

$sunflower_tag = $attributes['tag'] ?? '';
$sunflower_count = isset( $attributes['count'] ) ? (int) $attributes['count'] : 3;
$sunflower_title = ( isset( $attributes['title'] ) && '' !== $attributes['title'] ) ? $attributes['title'] : __( 'Next events', 'sunflower-next-events' );
$sunflower_title = array_key_exists( 'title', $attributes ) ? (string) $attributes['title'] : __( 'Next events', 'sunflower-next-events' );
$sunflower_title_markup = ! empty( $sunflower_title ) ? sprintf( '<h2 class="wp-block-heading has-text-align-center h1">%s</h2>', esc_html( $sunflower_title ) ) : '';
$sunflower_classes = $attributes['className'] ?? '';
$sunflower_event_title_filter = $attributes['eventTitleFilter'] ?? '';
$sunflower_archive_url = get_post_type_archive_link( 'sunflower_event' );
Expand All @@ -18,10 +19,10 @@
$sunflower_return = sprintf(
'<div class="wp-block-group has-text-color has-white-color has-background is-vertical is-content-justification-center is-layout-flex wp-block-group-is-layout-flex next-events %s">
<div class="wp-block-group__inner-container">
<h2 class="wp-block-heading has-text-align-center h1">%s</h2>
%s
<div class="row">',
esc_attr( $sunflower_classes ),
esc_html( $sunflower_title )
$sunflower_title_markup
);

ob_start();
Expand Down