-
Notifications
You must be signed in to change notification settings - Fork 34
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
PLANET-7548: Move Action pattern block to theme (#2338)
Ref: https://jira.greenpeace.org/browse/PLANET-7548 Include all related files Co-authored-by: Dan Tovbein <[email protected]>
- Loading branch information
1 parent
552837e
commit aeb619b
Showing
6 changed files
with
96 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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/action", | ||
"title": "Action", | ||
"category": "planet4-block-templates", | ||
"icon": "editor-table", | ||
"textdomain": "planet4-blocks-backend" | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
import gravityFormWithText from '../templates/gravity-form-with-text'; | ||
|
||
const {__} = wp.i18n; | ||
|
||
const template = () => ([ | ||
['core/group', {className: 'block'}, [ | ||
gravityFormWithText('white'), | ||
['core/group', { | ||
backgroundColor: 'beige-100', | ||
align: 'full', | ||
style: { | ||
spacing: { | ||
padding: { | ||
top: '80px', | ||
bottom: '80px', | ||
}, | ||
}, | ||
}, | ||
}, [ | ||
['core/group', {className: 'container'}, [ | ||
['planet4-block-templates/side-image-with-text-and-cta', { | ||
title: __('The problem', 'planet4-blocks'), | ||
mediaPosition: 'right', | ||
}], | ||
]], | ||
]], | ||
['planet4-blocks/covers', { | ||
cover_type: 'take-action', | ||
}], | ||
['core/separator', {backgroundColor: 'grey-20'}], | ||
['planet4-block-templates/quick-links', { | ||
title: __('Explore by topics', 'planet4-blocks'), | ||
backgroundColor: 'white', | ||
}], | ||
]], | ||
]); | ||
|
||
export default template; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
<?php | ||
|
||
/** | ||
* Action pattern class. | ||
* | ||
* @package P4\MasterTheme\Patterns | ||
* @since 0.1 | ||
*/ | ||
|
||
namespace P4\MasterTheme\Patterns; | ||
|
||
/** | ||
* Class Action. | ||
* | ||
* @package P4\MasterTheme\Patterns | ||
*/ | ||
class Action extends BlockPattern | ||
{ | ||
/** | ||
* @inheritDoc | ||
*/ | ||
public static function get_name(): string | ||
{ | ||
return 'p4/action-pattern-layout'; | ||
} | ||
|
||
/** | ||
* @inheritDoc | ||
*/ | ||
public static function get_config($params = []): array | ||
{ | ||
return [ | ||
'title' => 'Action', | ||
'categories' => [ 'layouts' ], | ||
'blockTypes' => [ 'core/post-content' ], | ||
'postTypes' => [ 'page', 'p4_action', 'campaign' ], | ||
'content' => ' | ||
<!-- wp:planet4-block-templates/action ' . wp_json_encode($params, \JSON_FORCE_OBJECT) . ' /--> | ||
', | ||
]; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters