diff --git a/config/sync/field.field.node.landing.field_metatags.yml b/config/sync/field.field.node.landing.field_metatags.yml index fb666a1bc..113317516 100644 --- a/config/sync/field.field.node.landing.field_metatags.yml +++ b/config/sync/field.field.node.landing.field_metatags.yml @@ -12,7 +12,7 @@ field_name: field_metatags entity_type: node bundle: landing label: Metatags -description: '' +description: "Resources for Page Title best practices:\r\n" required: false translatable: true default_value: { } diff --git a/config/sync/field.field.node.page.field_metatags.yml b/config/sync/field.field.node.page.field_metatags.yml index ca7a6d295..329443bf0 100644 --- a/config/sync/field.field.node.page.field_metatags.yml +++ b/config/sync/field.field.node.page.field_metatags.yml @@ -12,7 +12,7 @@ field_name: field_metatags entity_type: node bundle: page label: Metatags -description: '' +description: "Resources for Page Title best practices:\r\n" required: false translatable: true default_value: { } diff --git a/config/sync/field.field.node.state_territory.field_metatags.yml b/config/sync/field.field.node.state_territory.field_metatags.yml index 49f95d8d8..e67de4398 100644 --- a/config/sync/field.field.node.state_territory.field_metatags.yml +++ b/config/sync/field.field.node.state_territory.field_metatags.yml @@ -12,7 +12,7 @@ field_name: field_metatags entity_type: node bundle: state_territory label: Metatags -description: '' +description: "Resources for Page Title best practices:\r\n" required: false translatable: true default_value: { } diff --git a/config/sync/field.field.node.voter_guide.field_metatags.yml b/config/sync/field.field.node.voter_guide.field_metatags.yml index 6422f02eb..cf613093e 100644 --- a/config/sync/field.field.node.voter_guide.field_metatags.yml +++ b/config/sync/field.field.node.voter_guide.field_metatags.yml @@ -12,7 +12,7 @@ field_name: field_metatags entity_type: node bundle: voter_guide label: Metatags -description: '' +description: "Resources for Page Title best practices:\r\n" required: false translatable: true default_value: { } diff --git a/web/modules/custom/vote_utility/inc/form_alter.inc b/web/modules/custom/vote_utility/inc/form_alter.inc index 8b5ff670f..7228c626a 100644 --- a/web/modules/custom/vote_utility/inc/form_alter.inc +++ b/web/modules/custom/vote_utility/inc/form_alter.inc @@ -22,6 +22,38 @@ function vote_utility_form_alter(&$form, FormStateInterface $form_state, $form_i } } +/** + * Implements hook_form_FORM_ID_alter(). + */ +function vote_utility_form_node_form_alter(&$form, FormStateInterface $form_state, $form_id) { + // Content types that are not user facing content pages. + $non_content_bundles = [ + 'node_nvrf_page_edit_form', + 'node_nvrf_page_form', + 'node_state_territory_edit_form', + 'node_state_territory_form', + ]; + // Content types that are comprised of components. + $landing_bundles = [ + 'node_landing_edit_form', + 'node_landing_form', + ]; + + // Add help text for Title field. + if (!in_array($form_id, $non_content_bundles)) { + if (isset($form['title']) && $form['title']['#access']) { + $form['title']['widget'][0]['value']['#description'] = [ + '#markup' => 'This field value will display on the page as a heading level 1. WCAG heading level guide', + ]; + + // Provide alternative help for a landing page. + if (in_array($form_id, $landing_bundles)) { + $form['title']['widget'][0]['value']['#description'] = 'This field value will not display on the page. Add a Page Component that includes content that displays on the page as a heading level 1.'; + } + } + } +} + /** * Implements hook_form_FORM_ID_alter(). */