After commit of #5 commit of #attribute on https://www.drupal.org/node/2627442 , I am still getting the same warning due to is_array() throwing exception

$element['#attributes'] = is_array($element['#attributes']) ? $element['#attributes'] : array();

In this when the condition of is_array() is true then it means that $element[#attributes] is defined but when the condition is false then it means that in element #attributes is not defined so it is throwing the exception.
When condition is true then everything works fine but when it is not then it does not work fine.
So when i tried !empty instead of is_array() it worked for me.

$element['#attributes'] = !empty($element['#attributes']) ? $element['#attributes'] : array();

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

akshay4627 created an issue. See original summary.

akshay4627’s picture

FileSize
607 bytes
shadcn’s picture

Thanks @akshay4627. Let me test this.

shadcn’s picture

@akshay4627 what if we use what core already uses? Can you test this patch and see if it solves your issue? Thanks.

akshay4627’s picture

@arshadcn Yes the patch in #4 is working fine but my patch made for https://www.drupal.org/node/2627442#comment-10823450 commit .

shadcn’s picture

Yeah I think this should fix it for both issues.

Albert Volkman’s picture

@arshadcn what's the status of this ticket?