Skip to content

Commit

Permalink
PLANET-7550: Move Deep Dive Topic pattern block to theme (#2339)
Browse files Browse the repository at this point in the history
* PLANET-7550: Add Deep Dive Topic pattern block

- The Deep Dive Topic pattern was moved to the theme

* PLANET-7550: Fix php lint errors

- PHP lint errors were fixed

* PLANET-7550: Fix file format

- Identation was fixed and an empty line was added at the end of the file
  • Loading branch information
mardelnet authored Aug 5, 2024
1 parent 38f9e8b commit 5771924
Show file tree
Hide file tree
Showing 6 changed files with 92 additions and 0 deletions.
9 changes: 9 additions & 0 deletions assets/src/block-templates/deep-dive-topic/block.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
{
"$schema": "https://schemas.wp.org/trunk/block.json",
"apiVersion": 2,
"name": "planet4-block-templates/deep-dive-topic",
"title": "Deep Dive Topic",
"category": "planet4-block-templates",
"icon": "editor-table",
"textdomain": "planet4-blocks-backend"
}
4 changes: 4 additions & 0 deletions assets/src/block-templates/deep-dive-topic/index.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
import metadata from './block.json';
import template from './template';

export {metadata, template};
34 changes: 34 additions & 0 deletions assets/src/block-templates/deep-dive-topic/template.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
const {__} = wp.i18n;

const template = () => ([
['core/group', {}, [
['planet4-block-templates/page-header', {
titlePlaceholder: __('Page header title', 'planet4-blocks'),
mediaPosition: 'right',
}],
['core/spacer', {height: '64px'}],
['planet4-block-templates/side-image-with-text-and-cta', {
title: __('The problem', 'planet4-blocks'),
}],
['planet4-block-templates/side-image-with-text-and-cta', {
title: __('What can be done', 'planet4-blocks'),
mediaPosition: 'right',
}],
['planet4-blocks/covers', {
title: __('How you can help', 'planet4-blocks'),
cover_type: 'take-action',
}],
['planet4-blocks/articles', {
article_heading: __('Latest news & stories', 'planet4-blocks'),
}],
['planet4-block-templates/deep-dive', {
title: __('Keep learning about', 'planet4-blocks'),
}],
['planet4-block-templates/quick-links', {
title: __('Explore other topics', 'planet4-blocks'),
backgroundColor: 'white',
}],
]],
]);

export default template;
2 changes: 2 additions & 0 deletions assets/src/block-templates/template-list.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ import * as pageHeader from './page-header';
import * as highLevelTopic from './high-level-topic';
import * as homepage from './homepage';
import * as getInformed from './get-informed';
import * as deepDiveTopic from './deep-dive-topic';

export default [
sideImgTextCta,
Expand All @@ -22,4 +23,5 @@ export default [
highLevelTopic,
homepage,
getInformed,
deepDiveTopic,
];
1 change: 1 addition & 0 deletions src/Patterns/BlockPattern.php
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@ public static function get_list(): array
return [
BlankPage::class,
DeepDive::class,
DeepDiveTopic::class,
GetInformed::class,
HighLevelTopic::class,
HighlightedCta::class,
Expand Down
42 changes: 42 additions & 0 deletions src/Patterns/DeepDiveTopic.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
<?php

/**
* DeepDiveTopic class.
*
* @package P4\MasterTheme\Patterns
* @since 0.1
*/

namespace P4\MasterTheme\Patterns;

/**
* Class DeepDiveTopic.
*
* @package P4\MasterTheme\Patterns
*/
class DeepDiveTopic extends BlockPattern
{
/**
* @inheritDoc
*/
public static function get_name(): string
{
return 'p4/deep-dive-topic-pattern-layout';
}

/**
* @inheritDoc
*/
public static function get_config($params = []): array
{
return [
'title' => 'Deep Dive Topic',
'categories' => [ 'layouts' ],
'blockTypes' => [ 'core/post-content' ],
'content' => '
<!-- wp:planet4-block-templates/deep-dive-topic ' .
wp_json_encode($params, \JSON_FORCE_OBJECT) .
' /-->',
];
}
}

0 comments on commit 5771924

Please sign in to comment.