CityOfBoston / Iterators

Repo to host files and manage issue tracking and QA tetsing.
0 stars 0 forks source link

The Search text fields moved per #215 - now getting errors in log #217

Open padora-cob opened 3 years ago

padora-cob commented 3 years ago

Notice: Undefined index: id in bos_list_preprocess_form_element() (line 215 of modules/custom/bos_components/modules/bos_list/bos_list.module).

if(strtolower($variables['element']['#title']) === 'search' || $variables['element']['#attributes']['id'] === "edit-title") { $variables['label_display'] = 'after'; $variables['label']['#attributes']['class'] = 'sf-i-l'; }

Will need to add some conditional checks to avoid the errors, we don't see them on higher ENVs because we suppress the error messages.

padora-cob commented 3 years ago

I don't have perms on this repo, need to move this ticket or re-create it :/

padora-cob commented 3 years ago

We cannot guarantee that the "$variables['element'][XXXXX]" is available every time this hook runs. Just need to check if the variable we want to check against is available for comparison, if not then bail.

function bos_list_preprocess_form_element(&$variables) { if((isset($variables['element']['#title']) && strtolower($variables['element']['#title']) === 'search') || (isset($variables['element']['#attributes']['id']) && $variables['element']['#attributes']['id'] === "edit-title")) { $variables['label_display'] = 'after'; $variables['label']['#attributes']['class'] = 'sf-i-l'; } }

padora-cob commented 3 years ago

Also not sure if we are wanting this to change the labels on the admin pages? If so we may want to do the same to all of the admin textfield labels as it is kind of breaking some of the layouts a little.

image image