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

Allow overrides of allowed headings on localgov_heading_level field (or use the field config). #202

Open
andybroomfield opened this issue Oct 8, 2024 · 0 comments

Comments

@andybroomfield
Copy link
Contributor

This code in localgov_subsites_paragraphs sets which heading levels are allowed for several paragraph types (like key facts).

function _localgov_subsites_paragraphs_create_heading(string $heading_text, string $heading_level) {
  $allowed_heading_levels = ['h2', 'h3', 'h4', 'h5', 'h6'];

  if (!in_array($heading_level, $allowed_heading_levels, TRUE)) {
    return;
  }

By default, h1 is not allowed in the field config.

BHCC has created a seperate paragraph for creating headings that re-uses the same field.
Since the page title could potentially be turned off in our theme, we allow the h1 to be set. This though means we have to allow the h1 everywhere (I think, it seems to apply the config everywhere).
This causes a side effect that when a keyfact accidently sets to a h1, the heading itself disappears.

Could we use the field config to set the allowed values here? And then we can find a way to allow for seperate allowed values in the different paragraphs.

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

No branches or pull requests

1 participant