Skip to content

Commit

Permalink
Remove $args default from blocks making fields consistent
Browse files Browse the repository at this point in the history
  • Loading branch information
ronilaukkarinen committed Sep 12, 2022
1 parent df2b14c commit 17b9229
Show file tree
Hide file tree
Showing 17 changed files with 68 additions and 83 deletions.
4 changes: 3 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,8 +1,10 @@
### [Unreleased]
### 1.2.2: 2022-09-12

* Fix git pull didn't always go through - make sure self-updating always works
* Fix block classes for images
* Update block icons
* Add image-upsells-one-big-two-small icon
* Remove `$args` default from blocks making fields consistent

### 1.2.1: 2022-08-24

Expand Down
2 changes: 1 addition & 1 deletion bin/newblock.sh
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@

# Script specific vars
SCRIPT_LABEL='for macOS'
SCRIPT_VERSION='1.2.1 (2022-08-24)'
SCRIPT_VERSION='1.2.2 (2022-09-12)'

# Vars needed for this file to function globally
CURRENTFILE=`basename $0`
Expand Down
7 changes: 7 additions & 0 deletions bin/tasks/get-block.sh
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,14 @@ cd $HOME
git clone https://github.com/digitoimistodude/air-blocks $BLOCKS_PATH_TEMP
cd $BLOCKS_PATH_TEMP
git stash
git clean -fxd
if ! git pull
then
echo "${RED}Error: git pull failed! Cannot get updates. Make sure you don't have modifications in $BLOCKS_PATH_TEMP.${TXTRESET}"
exit
fi
git pull

echo "${YELLOW}Copying block files to the theme folder of the project: ${PROJECTS_HOME}/${PROJECT_NAME}/content/themes/${THEME_NAME}${TXTRESET}"

# Create blocks directory if it does not exist
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,14 +7,15 @@
* @Author: Tuomas Marttila
* @Date: 2022-01-07 11:12:46
* @Last Modified by: Roni Laukkarinen
* @Last Modified time: 2022-03-09 10:45:11
* @Last Modified time: 2022-09-12 13:49:04
*
* @package air-blocks
* @link https://developer.wordpress.org/themes/basics/template-files/#template-partials
*/

namespace Air_Light;

// Fields
$accordion_items = get_field( 'accordion_items' );

if ( empty( $accordion_items ) ) {
Expand Down
10 changes: 3 additions & 7 deletions content/themes/air-blocks/template-parts/blocks/carousel.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,20 +7,16 @@
* @Author: Tuomas Marttila
* @Date: 2021-12-15 10:20:37
* @Last Modified by: Roni Laukkarinen
* @Last Modified time: 2022-06-09 11:50:26
* @Last Modified time: 2022-09-12 13:49:00
*
* @package air-blocks
* @link https://developer.wordpress.org/themes/basics/template-files/#template-partials
*/

namespace Air_Light;

if ( ! isset( $args ) ) {
$title = get_field( 'title' );
} else {
$title = $args['title'];
}

// Fields
$title = get_field( 'title' );
$images = get_field( 'images' );

if ( empty( $images ) ) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,14 +7,15 @@
* @Author: Tuomas Marttila
* @Date: 2021-12-13 13:18:44
* @Last Modified by: Roni Laukkarinen
* @Last Modified time: 2022-03-09 10:45:36
* @Last Modified time: 2022-09-12 13:49:13
*
* @package air-blocks
* @link https://developer.wordpress.org/themes/basics/template-files/#template-partials
*/

namespace Air_Light;

// Fields
$title_left = get_field( 'title_left' );
$content_left = get_field( 'content_left' );
$title_right = get_field( 'title_right' );
Expand Down
3 changes: 2 additions & 1 deletion content/themes/air-blocks/template-parts/blocks/content.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,14 +7,15 @@
* @Author: Tuomas Marttila
* @Date: 2022-01-04 11:40:09
* @Last Modified by: Roni Laukkarinen
* @Last Modified time: 2022-03-09 10:49:04
* @Last Modified time: 2022-09-12 13:49:17
*
* @package air-blocks
* @link https://developer.wordpress.org/themes/basics/template-files/#template-partials
*/

namespace Air_Light;

// Fields
$content = get_field( 'content' );

if ( empty( $content ) ) {
Expand Down
15 changes: 5 additions & 10 deletions content/themes/air-blocks/template-parts/blocks/cta.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
* @Author: Roni Laukkarinen
* @Date: 2021-08-24 15:45:19
* @Last Modified by: Roni Laukkarinen
* @Last Modified time: 2022-03-09 10:46:14
* @Last Modified time: 2022-09-12 13:49:30
*
* @package air-blocks
* @link https://developer.wordpress.org/themes/basics/template-files/#template-partials
Expand All @@ -17,15 +17,10 @@

use function WP_CLI\Utils\maybe_require;

if ( ! isset( $args ) ) {
$title = get_field( 'title' );
$content = get_field( 'content' );
$link = get_field( 'link' );
} else {
$title = $args['title'];
$content = $args['content'];
$link = $args['link'];
}
// Fields
$title = get_field( 'title' );
$content = get_field( 'content' );
$link = get_field( 'link' );

if ( empty( $title ) ) {
maybe_show_error_block( 'Otsikko on pakollinen' );
Expand Down
3 changes: 2 additions & 1 deletion content/themes/air-blocks/template-parts/blocks/form.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
* @Author: Tuomas Marttila
* @Date: 2021-12-15 08:41:59
* @Last Modified by: Roni Laukkarinen
* @Last Modified time: 2022-03-09 10:46:21
* @Last Modified time: 2022-09-12 13:49:42
*
* @package air-blocks
* @link https://developer.wordpress.org/themes/basics/template-files/#template-partials
Expand All @@ -20,6 +20,7 @@
return;
}

// Fields
$type = get_field( 'type' );
$form = intval( get_field( 'form' ) );

Expand Down
22 changes: 8 additions & 14 deletions content/themes/air-blocks/template-parts/blocks/hero-big-image.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
* @Author: Tuomas Marttila
* @Date: 2022-02-08 09:45:56
* @Last Modified by: Roni Laukkarinen
* @Last Modified time: 2022-08-30 15:54:33
* @Last Modified time: 2022-09-12 13:49:55
*
* @package air-blocks
* @link https://developer.wordpress.org/themes/basics/template-files/#template-partials
Expand All @@ -20,20 +20,14 @@

namespace Air_Light;

if ( ! isset( $args ) ) {
$title = get_field( 'title' );
$content = get_field( 'content' );
$link = get_field( 'link' );
$bg_image = get_field( 'bg_image' );
// Fields
$title = get_field( 'title' );
$content = get_field( 'content' );
$link = get_field( 'link' );
$bg_image = get_field( 'bg_image' );

if ( empty( $bg_image ) ) {
$bg_image = get_post_thumbnail_id( get_the_ID() );
}
} else {
$title = $args['title'];
$content = $args['content'];
$link = $args['link'];
$bg_image = $args['bg_image'];
if ( empty( $bg_image ) ) {
$bg_image = get_post_thumbnail_id( get_the_ID() );
}

if ( empty( $title ) ) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,32 +7,24 @@
* @Author: Elias Kautto
* @Date: 2021-11-10 16:02:02
* @Last Modified by: Roni Laukkarinen
* @Last Modified time: 2022-08-30 15:54:36
* @Last Modified time: 2022-09-12 13:50:17
*
* @package airblocks
* @link https://developer.wordpress.org/themes/basics/template-files/#template-partials
*/

namespace Air_Light;

if ( ! isset( $args ) ) {
$upper_title = get_field( 'upper_title' );
$title = get_field( 'title' );
$content = get_field( 'content' );
$button = get_field( 'button' );
$video = get_field( 'video' );
$bg_image = get_field( 'bg_image' );
// Fields
$upper_title = get_field( 'upper_title' );
$title = get_field( 'title' );
$content = get_field( 'content' );
$button = get_field( 'button' );
$video = get_field( 'video' );
$bg_image = get_field( 'bg_image' );

if ( empty( $bg_image ) ) {
$bg_image = get_post_thumbnail_id( get_the_ID() );
}
} else {
$upper_title = $args['upper_title'];
$title = $args['title'];
$content = $args['content'];
$button = $args['button'];
$bg_image = $args['bg_image'];
$video = $args['video'];
if ( empty( $bg_image ) ) {
$bg_image = get_post_thumbnail_id( get_the_ID() );
}

$style = 'low';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
* @Author: Tuomas Marttila
* @Date: 2022-02-08 09:46:05
* @Last Modified by: Roni Laukkarinen
* @Last Modified time: 2022-08-30 15:54:39
* @Last Modified time: 2022-09-12 13:50:43
*
* @package air-blocks
* @link https://developer.wordpress.org/themes/basics/template-files/#template-partials
Expand All @@ -20,28 +20,18 @@

namespace Air_Light;

if ( ! isset( $args ) ) {
$title = get_field( 'title' );
$content = get_field( 'content' );
$image = get_field( 'image' );
$mode = get_field( 'mode' );

if ( 'link' === $mode ) {
$link = get_field( 'link' );
}

if ( empty( $bg_image ) ) {
$bg_image = get_post_thumbnail_id( get_the_ID() );
}
} else {
$title = $args['title'];
$content = $args['content'];
$image = $args['image'];
$mode = $args['mode'];

if ( 'link' === $args['mode'] ) {
$link = $args['link'];
}
// Fields
$title = get_field( 'title' );
$content = get_field( 'content' );
$image = get_field( 'image' );
$mode = get_field( 'mode' );

if ( 'link' === $mode ) {
$link = get_field( 'link' );
}

if ( empty( $bg_image ) ) {
$bg_image = get_post_thumbnail_id( get_the_ID() );
}

if ( empty( $title ) ) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
* @Author: Tuomas Marttila
* @Date: 2021-12-13 15:55:55
* @Last Modified by: Roni Laukkarinen
* @Last Modified time: 2022-03-09 10:47:19
* @Last Modified time: 2022-09-12 13:50:48
*
* @package air-blocks
* @link https://developer.wordpress.org/themes/basics/template-files/#template-partials
Expand All @@ -25,6 +25,7 @@

namespace Air_Light;

// Fields
$columns = get_field( 'columns' );

if ( empty( $columns ) ) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
* @Author: Tuomas Marttila
* @Date: 2021-12-14 11:00:36
* @Last Modified by: Roni Laukkarinen
* @Last Modified time: 2022-08-30 15:54:42
* @Last Modified time: 2022-09-12 13:50:59
*
* @package air-blocks
* @link https://developer.wordpress.org/themes/basics/template-files/#template-partials
Expand All @@ -19,6 +19,7 @@

namespace Air_Light;

// Fields
$columns = get_field( 'columns' );

if ( empty( $columns ) ) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
* @Author: Tuomas Marttila
* @Date: 2021-12-14 12:42:52
* @Last Modified by: Roni Laukkarinen
* @Last Modified time: 2022-08-30 15:54:45
* @Last Modified time: 2022-09-12 13:51:03
*
* @package air-blocks
* @link https://developer.wordpress.org/themes/basics/template-files/#template-partials
Expand All @@ -19,6 +19,7 @@

namespace Air_Light;

// Fields
$title = get_field( 'title' );
$image_side = get_field( 'media_side' );
$content = get_field( 'content' );
Expand Down
3 changes: 2 additions & 1 deletion content/themes/air-blocks/template-parts/blocks/quote.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
* @Author: Tuomas Marttila
* @Date: 2021-12-13 15:10:07
* @Last Modified by: Roni Laukkarinen
* @Last Modified time: 2022-03-09 10:47:56
* @Last Modified time: 2022-09-12 13:51:06
*
* @package air-blocks
* @link https://developer.wordpress.org/themes/basics/template-files/#template-partials
Expand All @@ -20,6 +20,7 @@

namespace Air_Light;

// Fields
$content = get_field( 'content' );
$author = get_field( 'author' );

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
* @Author: Tuomas Marttila
* @Date: 2021-12-13 12:23:42
* @Last Modified by: Roni Laukkarinen
* @Last Modified time: 2022-03-09 10:48:49
* @Last Modified time: 2022-09-12 13:51:09
*
* @package air-blocks
* @link https://developer.wordpress.org/themes/basics/template-files/#template-partials
Expand All @@ -19,6 +19,7 @@

namespace Air_Light;

// Fields
$title = get_field( 'title' );
$content = get_field( 'content' );

Expand Down

0 comments on commit 17b9229

Please sign in to comment.