Skip to content

Commit

Permalink
feat(YALB-1428): set default values for variables
Browse files Browse the repository at this point in the history
Set defaults in case there ever is an instance where the array items do
not exist, allowing the method to progress gracefully.
  • Loading branch information
dblanken-yale committed Aug 28, 2023
1 parent b6bcfbb commit ec7e588
Showing 1 changed file with 2 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -321,8 +321,8 @@ function ys_core_taxonomy_term_update() {
* "Call-to-action text".
*/
function ys_core_field_widget_complete_form_alter(&$field_widget_complete_form, FormStateInterface $form_state, $context) {
$widget = &$field_widget_complete_form['widget']['0'];
$is_field_link = $field_widget_complete_form['widget']['#field_name'] == "field_link";
$widget = &$field_widget_complete_form['widget']['0'] ?? NULL;
$is_field_link = ($field_widget_complete_form['widget']['#field_name'] ?? "") == "field_link";

if (isset($widget) && $widget['#bundle'] == 'cta_banner' && $is_field_link) {
$widget['title']['#title'] = t('Call-to-action text');
Expand Down

0 comments on commit ec7e588

Please sign in to comment.