diff --git a/CHANGELOG.md b/CHANGELOG.md index 69eae47..d6e9795 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -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 diff --git a/bin/newblock.sh b/bin/newblock.sh index 9a7a548..4d41a0f 100755 --- a/bin/newblock.sh +++ b/bin/newblock.sh @@ -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` diff --git a/bin/tasks/get-block.sh b/bin/tasks/get-block.sh index 3fa1496..6c18113 100644 --- a/bin/tasks/get-block.sh +++ b/bin/tasks/get-block.sh @@ -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 diff --git a/content/themes/air-blocks/template-parts/blocks/accordion.php b/content/themes/air-blocks/template-parts/blocks/accordion.php index d60a182..162615f 100644 --- a/content/themes/air-blocks/template-parts/blocks/accordion.php +++ b/content/themes/air-blocks/template-parts/blocks/accordion.php @@ -7,7 +7,7 @@ * @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 @@ -15,6 +15,7 @@ namespace Air_Light; +// Fields $accordion_items = get_field( 'accordion_items' ); if ( empty( $accordion_items ) ) { diff --git a/content/themes/air-blocks/template-parts/blocks/carousel.php b/content/themes/air-blocks/template-parts/blocks/carousel.php index 4401ffa..b2720c9 100644 --- a/content/themes/air-blocks/template-parts/blocks/carousel.php +++ b/content/themes/air-blocks/template-parts/blocks/carousel.php @@ -7,7 +7,7 @@ * @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 @@ -15,12 +15,8 @@ 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 ) ) { diff --git a/content/themes/air-blocks/template-parts/blocks/content-columns-50-50.php b/content/themes/air-blocks/template-parts/blocks/content-columns-50-50.php index c576f61..d12d136 100644 --- a/content/themes/air-blocks/template-parts/blocks/content-columns-50-50.php +++ b/content/themes/air-blocks/template-parts/blocks/content-columns-50-50.php @@ -7,7 +7,7 @@ * @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 @@ -15,6 +15,7 @@ namespace Air_Light; +// Fields $title_left = get_field( 'title_left' ); $content_left = get_field( 'content_left' ); $title_right = get_field( 'title_right' ); diff --git a/content/themes/air-blocks/template-parts/blocks/content.php b/content/themes/air-blocks/template-parts/blocks/content.php index 8193e3f..066bc80 100644 --- a/content/themes/air-blocks/template-parts/blocks/content.php +++ b/content/themes/air-blocks/template-parts/blocks/content.php @@ -7,7 +7,7 @@ * @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 @@ -15,6 +15,7 @@ namespace Air_Light; +// Fields $content = get_field( 'content' ); if ( empty( $content ) ) { diff --git a/content/themes/air-blocks/template-parts/blocks/cta.php b/content/themes/air-blocks/template-parts/blocks/cta.php index dc921c0..08f35be 100644 --- a/content/themes/air-blocks/template-parts/blocks/cta.php +++ b/content/themes/air-blocks/template-parts/blocks/cta.php @@ -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 @@ -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' ); diff --git a/content/themes/air-blocks/template-parts/blocks/form.php b/content/themes/air-blocks/template-parts/blocks/form.php index 1065a31..56b5146 100644 --- a/content/themes/air-blocks/template-parts/blocks/form.php +++ b/content/themes/air-blocks/template-parts/blocks/form.php @@ -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 @@ -20,6 +20,7 @@ return; } +// Fields $type = get_field( 'type' ); $form = intval( get_field( 'form' ) ); diff --git a/content/themes/air-blocks/template-parts/blocks/hero-big-image.php b/content/themes/air-blocks/template-parts/blocks/hero-big-image.php index be0f592..2b3c9ef 100644 --- a/content/themes/air-blocks/template-parts/blocks/hero-big-image.php +++ b/content/themes/air-blocks/template-parts/blocks/hero-big-image.php @@ -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 @@ -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 ) ) { diff --git a/content/themes/air-blocks/template-parts/blocks/hero-full-height.php b/content/themes/air-blocks/template-parts/blocks/hero-full-height.php index d9e5cea..eb3053e 100644 --- a/content/themes/air-blocks/template-parts/blocks/hero-full-height.php +++ b/content/themes/air-blocks/template-parts/blocks/hero-full-height.php @@ -7,7 +7,7 @@ * @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 @@ -15,24 +15,16 @@ 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'; diff --git a/content/themes/air-blocks/template-parts/blocks/hero-small-image.php b/content/themes/air-blocks/template-parts/blocks/hero-small-image.php index c315889..7e9a745 100644 --- a/content/themes/air-blocks/template-parts/blocks/hero-small-image.php +++ b/content/themes/air-blocks/template-parts/blocks/hero-small-image.php @@ -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 @@ -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 ) ) { diff --git a/content/themes/air-blocks/template-parts/blocks/icon-content-columns.php b/content/themes/air-blocks/template-parts/blocks/icon-content-columns.php index 9f9f3ae..f21101a 100644 --- a/content/themes/air-blocks/template-parts/blocks/icon-content-columns.php +++ b/content/themes/air-blocks/template-parts/blocks/icon-content-columns.php @@ -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 @@ -25,6 +25,7 @@ namespace Air_Light; +// Fields $columns = get_field( 'columns' ); if ( empty( $columns ) ) { diff --git a/content/themes/air-blocks/template-parts/blocks/image-content-columns.php b/content/themes/air-blocks/template-parts/blocks/image-content-columns.php index 400600a..818c60a 100644 --- a/content/themes/air-blocks/template-parts/blocks/image-content-columns.php +++ b/content/themes/air-blocks/template-parts/blocks/image-content-columns.php @@ -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 @@ -19,6 +19,7 @@ namespace Air_Light; +// Fields $columns = get_field( 'columns' ); if ( empty( $columns ) ) { diff --git a/content/themes/air-blocks/template-parts/blocks/image-content.php b/content/themes/air-blocks/template-parts/blocks/image-content.php index da7a223..d4f5e49 100644 --- a/content/themes/air-blocks/template-parts/blocks/image-content.php +++ b/content/themes/air-blocks/template-parts/blocks/image-content.php @@ -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 @@ -19,6 +19,7 @@ namespace Air_Light; +// Fields $title = get_field( 'title' ); $image_side = get_field( 'media_side' ); $content = get_field( 'content' ); diff --git a/content/themes/air-blocks/template-parts/blocks/quote.php b/content/themes/air-blocks/template-parts/blocks/quote.php index 3ae9e24..ba8349c 100644 --- a/content/themes/air-blocks/template-parts/blocks/quote.php +++ b/content/themes/air-blocks/template-parts/blocks/quote.php @@ -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 @@ -20,6 +20,7 @@ namespace Air_Light; +// Fields $content = get_field( 'content' ); $author = get_field( 'author' ); diff --git a/content/themes/air-blocks/template-parts/blocks/title-content-columns.php b/content/themes/air-blocks/template-parts/blocks/title-content-columns.php index 9af1ce7..7da9a50 100644 --- a/content/themes/air-blocks/template-parts/blocks/title-content-columns.php +++ b/content/themes/air-blocks/template-parts/blocks/title-content-columns.php @@ -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 @@ -19,6 +19,7 @@ namespace Air_Light; +// Fields $title = get_field( 'title' ); $content = get_field( 'content' );