Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. Weโ€™ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feature/wdsus 7 implement wp cli #1006

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
27 commits
Select commit Hold shift + click to select a range
abb9a36
composer install wp-cli
Apr 28, 2023
97357b2
initial copy wp-cli command from acf-wds-blocks
Apr 28, 2023
e6f011d
adding some additional stubs used in the project
Apr 28, 2023
87bc681
scripts to build and watch blocks
Apr 28, 2023
63750db
including inc/wpcli/ folder
Apr 28, 2023
7e82049
we need this folder for the custom blocks
Apr 28, 2023
75d627d
instead of separated build, adding copy-php setting for blocks
Apr 28, 2023
8cbe194
fixing string replacement for namespace
Apr 28, 2023
56cda02
composer.lock
Apr 28, 2023
7979a6c
Merge branch 'main' into feature/WDSUS-7-Implement-WP-CLI
May 19, 2023
12c342a
Merge branch 'main' into feature/WDSUS-7-Implement-WP-CLI
May 26, 2023
a8f077b
adds schema | fixes supports.color and references to scripts and styles
May 26, 2023
bcce5f4
reverts adding -webpack-copy-php, not needed without tailwind
May 26, 2023
27a920a
early exit is class is already defined
May 26, 2023
9f1eeb1
renames prefix to wds (wd_s is not a valid block name)
May 26, 2023
a24a7b3
removes tailwind config
May 26, 2023
9049ec1
changes acf registration hook from `acf/init` to `init` | changed bloโ€ฆ
May 26, 2023
2e555af
exclude generated ACF JSON files
May 26, 2023
ffdeef9
simplified ACF block call-to-action
May 26, 2023
036e070
Merge branch 'main' into feature/WDSUS-7-Implement-WP-CLI
May 26, 2023
09ff681
Merge branch 'release/WDSUS-2-4.0-Theme-Revamp' into feature/WDSUS-7-โ€ฆ
khleomix Jun 1, 2023
f6a6c5d
removed CSS files | fixed JS file inclusion | set block category
Jun 2, 2023
9e6c878
test exlude acf json files
Jun 2, 2023
038f9ad
properly exclude generated ACF field groups (otherwise changes to fieโ€ฆ
Jun 2, 2023
936cac3
WDSUS-7 - Change CTA block category
khleomix Jun 6, 2023
0e6ad46
Merge branch 'feature/WDSUS-7-Implement-WP-CLI' of github.com:WebDevSโ€ฆ
khleomix Jun 6, 2023
b42f28c
porting changes from `wd_f`
Jun 21, 2023
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
2 changes: 1 addition & 1 deletion .vscode/settings.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
"editor.defaultFormatter": "esbenp.prettier-vscode"
},
"intelephense.format.enable": false,
"intelephense.stubs": [ "acf", "wordpress" ],
"intelephense.stubs": [ "acf", "wordpress", "standard", "Core", "pcre" ],

"workbench.colorCustomizations": {
"activityBar.background": "#3F4040",
Expand Down
145 changes: 145 additions & 0 deletions acf-json/group_6346c08d323e8.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,145 @@
{
"key": "group_6346c08d323e8",
"title": "Block: Call to Action",
"fields": [
{
"key": "field_635294c342393",
"label": "",
"name": "",
"aria-label": "",
"type": "message",
"instructions": "",
"required": 0,
"conditional_logic": 0,
"wrapper": {
"width": "",
"class": "",
"id": ""
},
"message": "<h2>Call to Action Block</h2>",
"new_lines": "wpautop",
"esc_html": 0
},
{
"key": "field_6346c08d2eb6f",
"label": "Eyebrow",
"name": "eyebrow",
"aria-label": "",
"type": "text",
"instructions": "",
"required": 0,
"conditional_logic": 0,
"wrapper": {
"width": "",
"class": "",
"id": ""
},
"default_value": "",
"maxlength": "",
"placeholder": "",
"prepend": "",
"append": ""
},
{
"key": "field_6346c135fd3e5",
"label": "Heading",
"name": "heading",
"aria-label": "",
"type": "text",
"instructions": "",
"required": 0,
"conditional_logic": 0,
"wrapper": {
"width": "",
"class": "",
"id": ""
},
"default_value": "",
"maxlength": "",
"placeholder": "",
"prepend": "",
"append": ""
},
{
"key": "field_6346c16186509",
"label": "Content",
"name": "content",
"aria-label": "",
"type": "textarea",
"instructions": "",
"required": 0,
"conditional_logic": 0,
"wrapper": {
"width": "",
"class": "",
"id": ""
},
"default_value": "",
"maxlength": "",
"rows": 3,
"placeholder": "",
"new_lines": "wpautop"
},
{
"key": "field_6346c13efd3e6",
"label": "Button",
"name": "button",
"aria-label": "",
"type": "link",
"instructions": "",
"required": 0,
"conditional_logic": 0,
"wrapper": {
"width": "",
"class": "",
"id": ""
},
"return_format": "array"
},
{
"key": "field_6346ce226e894",
"label": "Layout",
"name": "layout",
"aria-label": "",
"type": "radio",
"instructions": "Left-aligned or Right-aligned content. The button will be on the opposite side of the content.\r\nCenter will stack and center-align the content.",
"required": 1,
"conditional_logic": 0,
"wrapper": {
"width": "",
"class": "",
"id": ""
},
"choices": {
"left": "Left",
"right": "Right",
"center": "Center"
},
"default_value": "left",
"return_format": "value",
"allow_null": 0,
"other_choice": 0,
"layout": "vertical",
"save_other_choice": 0
}
],
"location": [
[
{
"param": "block",
"operator": "==",
"value": "wds/call-to-action"
}
]
],
"menu_order": 0,
"position": "normal",
"style": "default",
"label_placement": "top",
"instruction_placement": "label",
"hide_on_screen": "",
"active": true,
"description": "",
"show_in_rest": 0,
"modified": 1687376907
}
Empty file added blocks/.gitkeep
Empty file.
31 changes: 31 additions & 0 deletions blocks/call-to-action/block.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
{
"$schema": "https://schemas.wp.org/trunk/block.json",
"apiVersion": 2,
"name": "wds/call-to-action",
"title": "Call to Action",
"description": "This block is used for wds.",
"editorScript": "file:./editor.js",
"script": "file:./script.js",
"category": "wds-blocks-category",
"icon": "megaphone",
"keywords": [ "call-to-action", "call-to-action", "block" ],
"acf": {
"mode": "auto",
"renderTemplate": "call-to-action.php"
},
"supports": {
"align": false,
"anchor": true,
"color": {},
"customClassName": true,
"jsx": true
},
"example": {
"attributes": {
"mode": "preview",
"data": {
"_is_preview": "true"
}
}
}
}
29 changes: 29 additions & 0 deletions blocks/call-to-action/call-to-action.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
<?php
/**
* BLOCK - Renders a Call to Action block
*
* @link https://developer.wordpress.org/block-editor/
*
* @package wd_s
*/

$wds_block = $block ?? '';
$wds_args = $args ?? get_fields();

$wds_atts = [
'class' => [ 'wds-block', 'wds-block-call-to-action' ],
'allowed_innerblocks' => [ 'core/heading', 'core/paragraph' ],
'id' => ( isset( $wds_block ) && ! empty( $wds_block['anchor'] ) ) ? $wds_block['anchor'] : '',
'fields' => [ 'eyebrow', 'heading', 'content', 'button_args', 'layout' ],
];

?>
<section class="<?php echo esc_attr( implode( ' ', $wds_atts['class'] ) ); ?>">
<?php
if ( ! empty( $wds_atts['allowed_innerblocks'] ) ) :
echo '<InnerBlocks allowedBlocks="' . esc_attr( wp_json_encode( $wds_atts['allowed_innerblocks'] ) ) . '" />';
endif;

get_template_part( 'blocks/modules/call-to-action-' . get_field( 'layout' ), null, $wds_args );
?>
</section>
5 changes: 5 additions & 0 deletions blocks/call-to-action/editor.asset.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
<?php // phpcs:ignore Squiz.Commenting.FileComment.Missing
return array(
'dependencies' => array(),
'version' => false,
);
1 change: 1 addition & 0 deletions blocks/call-to-action/editor.js
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
// Editor JS here.
5 changes: 5 additions & 0 deletions blocks/call-to-action/script.asset.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
<?php // phpcs:ignore Squiz.Commenting.FileComment.Missing
return array(
'dependencies' => array(),
'version' => false,
);
8 changes: 8 additions & 0 deletions blocks/call-to-action/script.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
/**
* Block script.
*
* @package
* @since 2.0.0
*/

// add JS here.
58 changes: 58 additions & 0 deletions blocks/modules/call-to-action-center.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
<?php
/**
* MODULE - Call to Action
*
* Modules are analagous to 'Molecules' in Brad Frost's Atomic Design Methodology.
*
* @link https://atomicdesign.bradfrost.com/chapter-2/#molecules
*
* @package abs
*/

$wds_defaults = [
'class' => [ 'wds-module', 'wds-module-call-to-action' ],
'eyebrow' => false,
'heading' => false,
'content' => false,
'button' => false,
];

$wds_args = wp_parse_args( $args, $wds_defaults );

// Set up element attributes.
$wds_atts = $wds_args['class'];

?>
<div class="<?php echo esc_attr( implode( ' ', $wds_atts ) ); ?>">
<div class="center-content">
<?php
// Eyebrow.
if ( $wds_args['eyebrow'] ) :
?>
<span class="wds-element wds-element-eyebrow"><?php echo wp_kses_post( $wds_args['eyebrow'] ); ?></span>
<?php
endif;

// Heading.
if ( $wds_args['heading'] ) :
?>
<h2 class="wds-element wds-element-heading"><?php echo wp_kses_post( $wds_args['heading'] ); ?></h2>
<?php
endif;

// Content.
if ( $wds_args['content'] ) :
?>
<section class="wds-element wds-element-content"><?php echo wp_kses_post( $wds_args['content'] ); ?></section>
<?php
endif;

// Button.
if ( ! empty( $wds_args['button'] ) ) :
?>
<a href="<?php echo esc_url( $wds_args['button']['url'] ); ?>">
<button class="wds-element wds-element-button"><?php echo wp_kses_post( $wds_args['button']['title'] ); ?></button>
</a>
<?php endif; ?>
</div>
</div>
58 changes: 58 additions & 0 deletions blocks/modules/call-to-action-left.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
<?php
/**
* MODULE - Call to Action
*
* Modules are analagous to 'Molecules' in Brad Frost's Atomic Design Methodology.
*
* @link https://atomicdesign.bradfrost.com/chapter-2/#molecules
*
* @package abs
*/

$wds_defaults = [
'class' => [ 'wds-module', 'wds-module-call-to-action' ],
'eyebrow' => false,
'heading' => false,
'content' => false,
'button' => false,
];

$wds_args = wp_parse_args( $args, $wds_defaults );

// Set up element attributes.
$wds_atts = $wds_args['class'];

?>
<div class="<?php echo esc_attr( implode( ' ', $wds_atts ) ); ?>">
<div class="left-content">
<?php
// Eyebrow.
if ( $wds_args['eyebrow'] ) :
?>
<span class="wds-element wds-element-eyebrow"><?php echo wp_kses_post( $wds_args['eyebrow'] ); ?></span>
<?php
endif;

// Heading.
if ( $wds_args['heading'] ) :
?>
<h2 class="wds-element wds-element-heading"><?php echo wp_kses_post( $wds_args['heading'] ); ?></h2>
<?php
endif;

// Content.
if ( $wds_args['content'] ) :
?>
<section class="wds-element wds-element-content"><?php echo wp_kses_post( $wds_args['content'] ); ?></section>
<?php
endif;

// Button.
if ( ! empty( $wds_args['button'] ) ) :
?>
<a href="<?php echo esc_url( $wds_args['button']['url'] ); ?>">
<button class="wds-element wds-element-button"><?php echo wp_kses_post( $wds_args['button']['title'] ); ?></button>
</a>
<?php endif; ?>
</div>
</div>
Loading