Skip to content

Commit

Permalink
fix location tablet-center
Browse files Browse the repository at this point in the history
  • Loading branch information
kadencewp committed Aug 19, 2024
1 parent f169f23 commit c9e19ae
Show file tree
Hide file tree
Showing 18 changed files with 102 additions and 53 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@ public function build_html( $attributes, $unique_id, $content, $block_instance )
if ( ! empty( $attributes['location'] ) && ! in_array( $attributes['location'], array( 'tablet-left', 'tablet-right', 'center-left', 'center', 'center-right' ) ) ) {

// If no center content, return empty div to keep layout consistent.
if( $attributes['location'] === 'tablet-center' && empty( $content ) ) {
if ( $attributes['location'] === 'tablet-center' && empty( $content ) ) {
return '<div></div>';
}

Expand All @@ -122,10 +122,9 @@ public function build_html( $attributes, $unique_id, $content, $block_instance )
$content = '<div class="wp-block-kadence-header-column wp-block-kadence-header-column-center-right"></div>' . $content;
}
}

if ( empty( $content ) ) {
$classes[] = 'no-content';
if ( ! empty( $attributes['location'] ) && $attributes['location'] == 'center' ) {
if ( ! empty( $attributes['location'] ) && ( 'center' === $attributes['location'] || 'tablet-center' === $attributes['location'] ) ) {
$classes[] = 'no-content-column-center';
}
}
Expand Down
9 changes: 6 additions & 3 deletions src/blocks/header/templates/basic-1.js
Original file line number Diff line number Diff line change
Expand Up @@ -339,7 +339,8 @@ function innerBlocks() {
'kadence/header-column',
{
uniqueID: '6_96ebcd-88',
metadata: { name: 'Center', location: 'tablet-center' },
location: 'tablet-center',
metadata: { name: 'Center' },
},
[]
),
Expand Down Expand Up @@ -389,7 +390,8 @@ function innerBlocks() {
'kadence/header-column',
{
uniqueID: '6_4503bc-d7',
metadata: { name: 'Center', location: 'tablet-center' },
location: 'tablet-center',
metadata: { name: 'Center' },
},
[
createBlock(
Expand Down Expand Up @@ -430,7 +432,8 @@ function innerBlocks() {
'kadence/header-column',
{
uniqueID: '6_1241a8-a6',
metadata: { name: 'Center', location: 'tablet-center' },
location: 'tablet-center',
metadata: { name: 'Center' },
},
[]
),
Expand Down
9 changes: 6 additions & 3 deletions src/blocks/header/templates/basic-2.js
Original file line number Diff line number Diff line change
Expand Up @@ -334,7 +334,8 @@ function innerBlocks() {
'kadence/header-column',
{
uniqueID: '6_552a9f-e7',
metadata: { name: 'Center', location: 'tablet-center' },
location: 'tablet-center',
metadata: { name: 'Center' },
},
[]
),
Expand Down Expand Up @@ -376,7 +377,8 @@ function innerBlocks() {
'kadence/header-column',
{
uniqueID: '6_16a0d7-83',
metadata: { name: 'Center', location: 'tablet-center' },
location: 'tablet-center',
metadata: { name: 'Center' },
},
[]
),
Expand Down Expand Up @@ -404,7 +406,8 @@ function innerBlocks() {
'kadence/header-column',
{
uniqueID: '6_c839f3-8d',
metadata: { name: 'Center', location: 'tablet-center' },
location: 'tablet-center',
metadata: { name: 'Center' },
},
[]
),
Expand Down
9 changes: 6 additions & 3 deletions src/blocks/header/templates/basic-3.js
Original file line number Diff line number Diff line change
Expand Up @@ -342,7 +342,8 @@ function innerBlocks() {
'kadence/header-column',
{
uniqueID: '6_8e1cce-17',
metadata: { name: 'Center', location: 'tablet-center' },
location: 'tablet-center',
metadata: { name: 'Center' },
},
[]
),
Expand Down Expand Up @@ -379,7 +380,8 @@ function innerBlocks() {
'kadence/header-column',
{
uniqueID: '6_7048f8-e9',
metadata: { name: 'Center', location: 'tablet-center' },
location: 'tablet-center',
metadata: { name: 'Center' },
},
[
createBlock(
Expand Down Expand Up @@ -434,7 +436,8 @@ function innerBlocks() {
'kadence/header-column',
{
uniqueID: '6_ee92c3-ac',
metadata: { name: 'Center', location: 'tablet-center' },
location: 'tablet-center',
metadata: { name: 'Center' },
},
[]
),
Expand Down
9 changes: 6 additions & 3 deletions src/blocks/header/templates/basic-4.js
Original file line number Diff line number Diff line change
Expand Up @@ -287,7 +287,8 @@ function innerBlocks() {
'kadence/header-column',
{
uniqueID: '10_44d96b-23',
metadata: { name: 'Center', location: 'tablet-center' },
location: 'tablet-center',
metadata: { name: 'Center' },
},
[]
),
Expand Down Expand Up @@ -316,7 +317,8 @@ function innerBlocks() {
'kadence/header-column',
{
uniqueID: '10_378ead-16',
metadata: { name: 'Center', location: 'tablet-center' },
location: 'tablet-center',
metadata: { name: 'Center' },
},
[]
),
Expand Down Expand Up @@ -344,7 +346,8 @@ function innerBlocks() {
'kadence/header-column',
{
uniqueID: '10_9324ca-ec',
metadata: { name: 'Center', location: 'tablet-center' },
location: 'tablet-center',
metadata: { name: 'Center' },
},
[]
),
Expand Down
9 changes: 6 additions & 3 deletions src/blocks/header/templates/basic-5.js
Original file line number Diff line number Diff line change
Expand Up @@ -334,7 +334,8 @@ function innerBlocks() {
'kadence/header-column',
{
uniqueID: '10_c2473b-5d',
metadata: { name: 'Center', location: 'tablet-center' },
location: 'tablet-center',
metadata: { name: 'Center' },
},
[]
),
Expand Down Expand Up @@ -375,7 +376,8 @@ function innerBlocks() {
'kadence/header-column',
{
uniqueID: '10_d71e8e-0c',
metadata: { name: 'Center', location: 'tablet-center' },
location: 'tablet-center',
metadata: { name: 'Center' },
},
[]
),
Expand Down Expand Up @@ -436,7 +438,8 @@ function innerBlocks() {
'kadence/header-column',
{
uniqueID: '10_8716fa-e6',
metadata: { name: 'Center', location: 'tablet-center' },
location: 'tablet-center',
metadata: { name: 'Center' },
},
[]
),
Expand Down
9 changes: 6 additions & 3 deletions src/blocks/header/templates/basic-6.js
Original file line number Diff line number Diff line change
Expand Up @@ -485,7 +485,8 @@ function innerBlocks() {
'kadence/header-column',
{
uniqueID: '10_2102c6-23',
metadata: { name: 'Center', location: 'tablet-center' },
location: 'tablet-center',
metadata: { name: 'Center' },
},
[]
),
Expand Down Expand Up @@ -526,7 +527,8 @@ function innerBlocks() {
'kadence/header-column',
{
uniqueID: '10_c2e29f-f3',
metadata: { name: 'Center', location: 'tablet-center' },
location: 'tablet-center',
metadata: { name: 'Center' },
},
[]
),
Expand Down Expand Up @@ -649,7 +651,8 @@ function innerBlocks() {
'kadence/header-column',
{
uniqueID: '10_f52042-78',
metadata: { name: 'Center', location: 'tablet-center' },
location: 'tablet-center',
metadata: { name: 'Center' },
},
[]
),
Expand Down
9 changes: 6 additions & 3 deletions src/blocks/header/templates/basic-7.js
Original file line number Diff line number Diff line change
Expand Up @@ -311,7 +311,8 @@ function innerBlocks() {
'kadence/header-column',
{
uniqueID: '10_a628c2-31',
metadata: { name: 'Center', location: 'tablet-center' },
location: 'tablet-center',
metadata: { name: 'Center' },
},
[]
),
Expand Down Expand Up @@ -352,7 +353,8 @@ function innerBlocks() {
'kadence/header-column',
{
uniqueID: '10_c2fbc3-92',
metadata: { name: 'Center', location: 'tablet-center' },
location: 'tablet-center',
metadata: { name: 'Center' },
},
[]
),
Expand Down Expand Up @@ -399,7 +401,8 @@ function innerBlocks() {
'kadence/header-column',
{
uniqueID: '10_d5ddbd-e2',
metadata: { name: 'Center', location: 'tablet-center' },
location: 'tablet-center',
metadata: { name: 'Center' },
},
[]
),
Expand Down
9 changes: 6 additions & 3 deletions src/blocks/header/templates/blank.js
Original file line number Diff line number Diff line change
Expand Up @@ -254,7 +254,8 @@ function innerBlocks() {
'kadence/header-column',
{
uniqueID: '6_96ebcd-88',
metadata: { name: 'Center', location: 'tablet-center' },
location: 'tablet-center',
metadata: { name: 'Center' },
},
[]
),
Expand Down Expand Up @@ -291,7 +292,8 @@ function innerBlocks() {
'kadence/header-column',
{
uniqueID: '6_4503bc-d7',
metadata: { name: 'Center', location: 'tablet-center' },
location: 'tablet-center',
metadata: { name: 'Center' },
},
[]
),
Expand Down Expand Up @@ -320,7 +322,8 @@ function innerBlocks() {
'kadence/header-column',
{
uniqueID: '6_1241a8-a6',
metadata: { name: 'Center', location: 'tablet-center' },
location: 'tablet-center',
metadata: { name: 'Center' },
},
[]
),
Expand Down
9 changes: 6 additions & 3 deletions src/blocks/header/templates/mobile-1.js
Original file line number Diff line number Diff line change
Expand Up @@ -338,7 +338,8 @@ function innerBlocks() {
'kadence/header-column',
{
uniqueID: '42_4e4853-63',
metadata: { name: 'Center', location: 'tablet-center' },
location: 'tablet-center',
metadata: { name: 'Center' },
},
[]
),
Expand Down Expand Up @@ -388,7 +389,8 @@ function innerBlocks() {
'kadence/header-column',
{
uniqueID: '42_c5037b-3f',
metadata: { name: 'Center', location: 'tablet-center' },
location: 'tablet-center',
metadata: { name: 'Center' },
},
[
createBlock(
Expand Down Expand Up @@ -429,7 +431,8 @@ function innerBlocks() {
'kadence/header-column',
{
uniqueID: '42_a6e551-1c',
metadata: { name: 'Center', location: 'tablet-center' },
location: 'tablet-center',
metadata: { name: 'Center' },
},
[]
),
Expand Down
9 changes: 6 additions & 3 deletions src/blocks/header/templates/mobile-2.js
Original file line number Diff line number Diff line change
Expand Up @@ -323,7 +323,8 @@ function innerBlocks() {
'kadence/header-column',
{
uniqueID: '56_f363d3-79',
metadata: { name: 'Center', location: 'tablet-center' },
location: 'tablet-center',
metadata: { name: 'Center' },
},
[]
),
Expand Down Expand Up @@ -373,7 +374,8 @@ function innerBlocks() {
'kadence/header-column',
{
uniqueID: '56_2a5574-34',
metadata: { name: 'Center', location: 'tablet-center' },
location: 'tablet-center',
metadata: { name: 'Center' },
},
[
createBlock(
Expand Down Expand Up @@ -414,7 +416,8 @@ function innerBlocks() {
'kadence/header-column',
{
uniqueID: '56_1fe859-b7',
metadata: { name: 'Center', location: 'tablet-center' },
location: 'tablet-center',
metadata: { name: 'Center' },
},
[]
),
Expand Down
9 changes: 6 additions & 3 deletions src/blocks/header/templates/mobile-3.js
Original file line number Diff line number Diff line change
Expand Up @@ -292,7 +292,8 @@ function innerBlocks() {
'kadence/header-column',
{
uniqueID: '75_98c204-ff',
metadata: { name: 'Center', location: 'tablet-center' },
location: 'tablet-center',
metadata: { name: 'Center' },
},
[]
),
Expand Down Expand Up @@ -343,7 +344,8 @@ function innerBlocks() {
'kadence/header-column',
{
uniqueID: '75_aba572-6e',
metadata: { name: 'Center', location: 'tablet-center' },
location: 'tablet-center',
metadata: { name: 'Center' },
},
[]
),
Expand Down Expand Up @@ -381,7 +383,8 @@ function innerBlocks() {
'kadence/header-column',
{
uniqueID: '75_218b70-b2',
metadata: { name: 'Center', location: 'tablet-center' },
location: 'tablet-center',
metadata: { name: 'Center' },
},
[]
),
Expand Down
9 changes: 6 additions & 3 deletions src/blocks/header/templates/mobile-4.js
Original file line number Diff line number Diff line change
Expand Up @@ -444,7 +444,8 @@ function innerBlocks() {
'kadence/header-column',
{
uniqueID: '88_a61084-4e',
metadata: { name: 'Center', location: 'tablet-center' },
location: 'tablet-center',
metadata: { name: 'Center' },
},
[]
),
Expand Down Expand Up @@ -494,7 +495,8 @@ function innerBlocks() {
'kadence/header-column',
{
uniqueID: '88_1e6337-10',
metadata: { name: 'Center', location: 'tablet-center' },
location: 'tablet-center',
metadata: { name: 'Center' },
},
[
createBlock(
Expand Down Expand Up @@ -555,7 +557,8 @@ function innerBlocks() {
'kadence/header-column',
{
uniqueID: '88_ef28da-f8',
metadata: { name: 'Center', location: 'tablet-center' },
location: 'tablet-center',
metadata: { name: 'Center' },
},
[]
),
Expand Down
Loading

0 comments on commit c9e19ae

Please sign in to comment.