vinkla / extended-acf

Register advanced custom fields with object-oriented PHP
MIT License
455 stars 61 forks source link

column() must be specified after wrapper() #134

Closed kaelansmith closed 1 year ago

kaelansmith commented 1 year ago

@vinkla Love the new column() method. I noticed that if you specify column() followed by wrapper(), wrapper() will override column(); example:

Image::make('Logo')
  ->instructions('For use on light backgrounds')
  ->column(50),
Image::make('Logo on dark')
  ->instructions('For use on dark backgrounds')
  ->column(50)
  ->wrapper(['class' => 'dark-bg']),

In this case ^, the second Image field won't be 50%. The simple solution is to move column() after wrapper():

Image::make('Logo')
  ->instructions('For use on light backgrounds')
  ->column(50),
Image::make('Logo on dark')
  ->instructions('For use on dark backgrounds')
  ->wrapper(['class' => 'dark-bg'])
  ->column(50),

and I can confirm that in this case ^, the class of 'dark-bg' still gets applied. So this isn't really a bug, but perhaps you could add a note to the README?

vinkla commented 1 year ago

I'm glad you like it, Kaelan! 🙌

If you're willing, please send a pull request to update the column section in the documentation.

vinkla commented 1 year ago

Another idea is to merge the existing settings in the wrapper method. This is the way.

Would you like to submit a pull request?

vinkla commented 1 year ago

Fixed in https://github.com/vinkla/extended-acf/releases/tag/13.7.1