Example #1
0
 /**
  * {@inheritdoc}
  */
 public function onDependencyRemoval(array $dependencies)
 {
     $changed = parent::onDependencyRemoval($dependencies);
     // Only the setting 'role' is resolved here. When the dependency related to
     // this setting is removed, is expected that the widget component will be
     // update accordingly in the display entity. The 'role2' setting is
     // deliberately left out from being updated. When the dependency
     // corresponding to this setting is removed, is expected that the widget
     // component will be disabled in the display entity.
     if (!empty($role_id = $this->getSetting('role'))) {
         if (!empty($dependencies['config']["user.role.{$role_id}"])) {
             $this->setSetting('role', 'anonymous');
             $changed = TRUE;
         }
     }
     return $changed;
 }