Problem/Motivation

When attempting to add roles to a domain if no existing roles have been added a warning is shown

Warning: array_keys() expects parameter 1 to be array, null given in Drupal\domain_role_access\Form\DomainRolesForm->buildForm() (line 47 of modules/contrib/domain_role_access/src/Form/DomainRolesForm.php).

Steps to reproduce

Navigate to the domain_role_access.admin route for a domain with no roles.

Proposed resolution

Add check for $config->get('roles') to ensure a valid value is present for the form.

Command icon Show commands

Start within a Git clone of the project using the version control instructions.

Or, if you do not have SSH keys set up on git.drupalcode.org:

Comments

Alexj12 created an issue. See original summary.

alexj12’s picture

Assigned: alexj12 » Unassigned
Status: Active » Needs review

MR created. Apologies for the extra branch - first patch submitted with the new issue forks!

anrkaid made their first commit to this issue’s fork.

anrkaid’s picture

  • anrkaid committed 8fb2fc3 on 8.x-1.x
    Issue #3184209 by Alexj12, anrkaid: Warning thrown when no roles...
anrkaid’s picture

Status: Needs review » Fixed

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.