*/
function deltabreen_maps_patterns() {
$h = function ( $text, $level = 2 ) {
return '' . esc_html( $text ) . '';
};
$p = function ( $text ) {
return '
' . esc_html( $text ) . '
';
};
return array(
'contact' => array(
'title' => __( 'Contact page with a map', 'maps-by-deltabreen' ),
'description' => __( 'Your address and how to reach you beside a map with a pin.', 'maps-by-deltabreen' ),
'content' => ''
. $h( __( 'Find us', 'maps-by-deltabreen' ) )
. $p( __( 'Street address, town and postcode', 'maps-by-deltabreen' ) )
. $p( __( 'Phone and email', 'maps-by-deltabreen' ) )
. $p( __( 'Opening hours', 'maps-by-deltabreen' ) )
. '
',
),
'locator' => array(
'title' => __( 'Store locator page', 'maps-by-deltabreen' ),
'description' => __( 'A search for the nearest of your locations, with hours and directions.', 'maps-by-deltabreen' ),
'content' => $h( __( 'Find a location near you', 'maps-by-deltabreen' ) )
. $p( __( 'Search by town or postcode, or use your location, to see the nearest first.', 'maps-by-deltabreen' ) )
. '',
),
'list' => array(
'title' => __( 'Locations with a list', 'maps-by-deltabreen' ),
'description' => __( 'All your locations on a map with a list beside it, Open now and category buttons.', 'maps-by-deltabreen' ),
'content' => $h( __( 'Our locations', 'maps-by-deltabreen' ) )
. '',
),
'delivery' => array(
'title' => __( 'Delivery areas', 'maps-by-deltabreen' ),
'description' => __( 'Your delivery areas on a map, and a search so visitors see whether they are inside one.', 'maps-by-deltabreen' ),
'content' => $h( __( 'Where we deliver', 'maps-by-deltabreen' ) )
. $p( __( 'Search for your address to see whether it is inside one of our delivery areas.', 'maps-by-deltabreen' ) )
. ''
. $p( __( 'To draw the areas, choose a KML or GeoJSON file of them in the map\'s More options (Google My Maps exports KML).', 'maps-by-deltabreen' ) ),
),
'event' => array(
'title' => __( 'Event venue', 'maps-by-deltabreen' ),
'description' => __( 'The date, the place and directions drawn on the page.', 'maps-by-deltabreen' ),
'content' => ''
. $h( __( 'The venue', 'maps-by-deltabreen' ) )
. $p( __( 'Date and time', 'maps-by-deltabreen' ) )
. $p( __( 'Venue name and address', 'maps-by-deltabreen' ) )
. $p( __( 'How to get there: parking, buses and trains', 'maps-by-deltabreen' ) )
. '
',
),
'trail' => array(
'title' => __( 'A trail with its profile', 'maps-by-deltabreen' ),
'description' => __( 'A walk or ride from a GPX file, with its length, climb and height profile.', 'maps-by-deltabreen' ),
'content' => $h( __( 'The route', 'maps-by-deltabreen' ) )
. $p( __( 'Distance, time and what to bring', 'maps-by-deltabreen' ) )
. ''
. $p( __( 'To draw the trail, choose its GPX file in the map\'s More options.', 'maps-by-deltabreen' ) ),
),
);
}
add_action(
'init',
function () {
if ( ! function_exists( 'register_block_pattern' ) ) {
return;
}
register_block_pattern_category( 'deltabreen-maps', array( 'label' => __( 'Maps by DeltaBreen', 'maps-by-deltabreen' ) ) );
foreach ( deltabreen_maps_patterns() as $slug => $pattern ) {
register_block_pattern(
'deltabreen-maps/' . $slug,
array(
'title' => $pattern['title'],
'description' => $pattern['description'],
'content' => $pattern['content'],
'categories' => array( 'deltabreen-maps' ),
'keywords' => array( 'map', 'location' ),
)
);
}
}
);