Skip to content
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

[Feature request] Gutenberg alignement support #674

Open
Mick00 opened this issue Feb 26, 2019 · 5 comments
Open

[Feature request] Gutenberg alignement support #674

Mick00 opened this issue Feb 26, 2019 · 5 comments
Labels
enhancement good first issue Feel free to contribute a PR to resolve issues like this one.

Comments

@Mick00
Copy link

Mick00 commented Feb 26, 2019

Version

  • Carbon Fields: 3.0.2
  • WordPress: 5.1
  • PHP: 7.?

Hi, I was testing Carbon Fields and as a replacement for ACF and while I was trying to make a gutenberg block I realised that there is no way to select an alignement (left, center, right, wide and full) for the block and implement it into my block and I haven't found any mention of how to enable this feature in the documentation. Did I miss it or is this feature missing? If so I think it would be great to see it get implemented.

Thanks

@vvasilev-
Copy link
Collaborator

Hi @Mick00,

Thank you for your feedback! Currently, this one isn't supported but we plan to implement it for the next release.

@vvasilev- vvasilev- added enhancement good first issue Feel free to contribute a PR to resolve issues like this one. labels Feb 26, 2019
@anujgtm
Copy link

anujgtm commented Jul 26, 2019

I have been facing the same issue and it's a show stopper for me at the moment. Looks like i might need to revert to ACF

@Mick00
Copy link
Author

Mick00 commented Jul 26, 2019

Hey there @anujgtm, there is a workaround this with the render callback function:
->set_render_callback( function ( $fields, $attributes, $inner_blocks )
The $attributes['className'] contains the name of the classes entered in the class field of the gutenberg editor. So, you can put alignwide or alignfull into this field and you bloc will align correctly if you implemented it correctly in your code. Just watch out for any errors if there is nothing in the field it won't be set.

Maybe not the perfect solution, but it works for me! But definitely a proper implementation of the alignment feature would be great.

@oobi
Copy link

oobi commented May 26, 2022

Any movement on this one?

@oobi
Copy link

oobi commented Mar 28, 2023

I'd like to see this also - particularly the ability to change the width in the editor. Setting a class attribute won't change the block width in the editor which can be limiting when dealing with child blocks.

For what it's worth, I include this on blocks where I need easy alignment:

Field::make('select', 'alignment', 'Alignment')
					->set_options( array(
						'' => 'None',
						'alignwide' => 'Wide',
						'alignfull' => 'Full Width'
					) )

then in my view:

<div class="my-component {{fields.alignment}} {{attributes.className}}">
```

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement good first issue Feel free to contribute a PR to resolve issues like this one.
Projects
None yet
Development

No branches or pull requests

4 participants