Open padora-cob opened 3 years ago
I don't have perms on this repo, need to move this ticket or re-create it :/
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'; } }
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.
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.