Skip to content

Commit

Permalink
feat(YALB-1428): change link title label
Browse files Browse the repository at this point in the history
This uses the hook_preprocess_form_element_label to intercept the call
to action field_link and change the title markup to 'Call-to-action
text' from 'Link text'.

Co-authored-by: @codechefmarc
  • Loading branch information
dblanken-yale committed Aug 25, 2023
1 parent 79d64fb commit cff3c8a
Showing 1 changed file with 12 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -313,3 +313,15 @@ function ys_core_preprocess_image_widget(&$variables) {
function ys_core_taxonomy_term_update() {
Cache::invalidateTags(['rendered']);
}

/**
* Implements hook_preprocess_form_element_label().
*
* Change the link widget text to 'Call-to-action text'
*/
function ys_core_preprocess_form_element_label(&$variables) {
if ($variables['theme_hook_original'] == "form_element_label__layout_builder_add_block__settings_block_form_field_link_0_title" ||
$variables['theme_hook_original'] == "form_element_label__layout_builder_update_block__settings_block_form_field_link_0_title") {
$variables['title']['#markup'] = 'Call-to-action text';
}
}

0 comments on commit cff3c8a

Please sign in to comment.