We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
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
Would be very useful if container or row would have an option to add id, along with class...Any chance of implementing this feature?
The text was updated successfully, but these errors were encountered:
Hi @gettonet. There was already a feature request to add an ID attribute to the blocks here: https://wordpress.org/support/topic/classes-being-added-to-the-block-outer-and-not-the-row/. As I wrote there in my opinion this should be a feature which should be added by Gutenberg itself. But since this doesn't seem to happen in the near future I will think about adding them to our blocks.
Sorry, something went wrong.
I agree that it would be nice feature to have - and it is easy to add it. Let's say for the row block we may add blockId or elementId attribute in:
blockId
elementId
class-row-block-type.php
protected $attributes = array( 'blockId' => array( 'type' => 'string', ),
the default value in the same file like:
protected $default_attributes = array( 'blockId' => '', ...
then in row/edit.js
const { blockId, ... } = attributes;
... <PanelBody> <TextControl label="Block Id" value={ blockId } onChange={ ( value ) => { setAttributes( { blockId: value, } ); } } /> </PanelBody> ...
and finally modify templates/row.php
$blockId = ""; if ( array_key_exists( 'blockId', $attributes ) && !empty( $attributes['blockId'] ) ) { $blockId = 'id="' . esc_attr( $attributes['blockId'] ) . '"'; }
and
<div <?php echo $blockId; ?> class="<?php echo esc_attr( implode( ' ', $classes ) ); ?>">
tschortsch
No branches or pull requests
Would be very useful if container or row would have an option to add id, along with class...Any chance of implementing this feature?
The text was updated successfully, but these errors were encountered: