-
Notifications
You must be signed in to change notification settings - Fork 60
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
fix (icon label): change icon gap #3209
Merged
Merged
Changes from 7 commits
Commits
Show all changes
10 commits
Select commit
Hold shift + click to select a range
e48c227
fix icon label gap
mxkae b4670b9
change implementation
mxkae 3c8b773
check icon size
mxkae ac48019
fix isEligible
mxkae b286ae5
update comments
mxkae 5f77b68
minor fix
mxkae 6b13aef
Update src/block/icon-label/style.scss [skip ci]
bfintal e6c2154
Update src/block/icon-label/schema.js [skip ci]
bfintal f35489b
fix flex value in editor
mxkae 113ac7e
fix deprecation for tablet and mobile
mxkae File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
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,32 @@ | ||
<?php | ||
|
||
// Exit if accessed directly. | ||
if ( ! defined( 'ABSPATH' ) ) { | ||
exit; | ||
} | ||
|
||
if ( ! function_exists( 'stackable_render_block_icon_label' ) ) { | ||
/** | ||
* Adds a special class if block uses the old icon gap attribute | ||
*/ | ||
function stackable_render_block_icon_label( $block_content, $block ) { | ||
$attributes = $block[ 'attrs' ]; | ||
|
||
// check if inner blocks contain an icon block | ||
if ( ! isset( $block[ 'innerBlocks' ][0] ) || ! isset( $block[ 'innerBlocks' ][0]['blockName'] ) || $block[ 'innerBlocks' ][0]['blockName'] !== 'stackable/icon' ) { | ||
return $block_content; | ||
} | ||
|
||
$icon_block_attrs = $block[ 'innerBlocks' ][0]['attrs']; | ||
|
||
// check if the block uses the old icon gap attribute | ||
$use_old_styles = ( isset( $attributes[ 'iconGap' ] ) || isset( $icon_block_attrs['iconSize'] ) ) && ! isset( $attributes[ 'iconGap2' ] ); | ||
|
||
if ( $use_old_styles ) { | ||
return preg_replace( '/stk-block-icon-label/i', 'stk-block-icon-label stk-block-icon-label--use-flex-basis', $block_content ); | ||
} | ||
|
||
return $block_content; | ||
} | ||
add_filter( 'render_block_stackable/icon-label', 'stackable_render_block_icon_label', 10, 2 ); | ||
} |
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
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 |
---|---|---|
|
@@ -32,11 +32,17 @@ export const attributes = ( version = VERSION ) => { | |
ConditionalDisplay.addAttributes( attrObject ) | ||
attrObject.add( { | ||
attributes: { | ||
// iconGap is deprecated but is kept for migration purposes | ||
iconGap: { | ||
type: 'number', | ||
stkResponsive: true, | ||
default: '', | ||
}, | ||
iconGap2: { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Add a comment on
bfintal marked this conversation as resolved.
Show resolved
Hide resolved
|
||
type: 'number', | ||
stkResponsive: true, | ||
default: '', | ||
}, | ||
}, | ||
versionAdded: '3.0.0', | ||
versionDeprecated: '', | ||
|
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
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Does it work if we remove the flex definition completely since this is for the old
0 0 64px
?There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
it still needs the flex, but i changed it to
flex: 0
instead.