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

Add option to display the field's label #22

Open
bobbingwide opened this issue Feb 4, 2024 · 1 comment
Open

Add option to display the field's label #22

bobbingwide opened this issue Feb 4, 2024 · 1 comment
Assignees
Labels
enhancement New feature or request

Comments

@bobbingwide
Copy link
Owner

Currently, if you want to display the label for a field and it's value it's necessary to use more than one block.
The first would be a paragraph block containing the required label, the second the acf field block.
eg The labels are in the first column, the values in the second.

image

This is a bit cumbersome.
It would be nice to request the block to display the label as well as the value.
It would also be nice to be able to override the value of label.

Requirement

  • Extend the ACF field block to support the display of the field's label.
  • This option would only need to be applied to top level fields.
  • It would probably not be necessary for complex fields such as flexible content or repeater fields.

Proposed solution

  • Add a toggle to enable the field's label to be displayed
  • Add a text field to enable the field's label to be overridden

The generated HTML would change from

<div class="acf-field-field_64aa869f48df7 acf-type-text has-text-align- wp-block-acf-field-acf-field">Content for the Text field</div>
<div class="acf-field-field_64aa869f48df7 acf-type-text has-text-align- wp-block-acf-field-acf-field">
<div class="label">Text</div>
<div class="value">Content for the Text field</div>
</div>

This could easily be styled as a grid.

@bobbingwide
Copy link
Owner Author

v1.3.0 is now available on wordpress.org. I downloaded it to s.b/cwiccer to test but the Display label logic isn't working.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

1 participant