Updated to Drupal 8.5. Core Media not yet in use.
[yaffs-website] / web / modules / contrib / entity_browser / src / Entity / EntityBrowser.php
index 6011f632abd56ed67b9990beb9b3351bc4159b98..53bc9f2aff5efde138786b9da1dea79898b4fe80 100644 (file)
@@ -352,7 +352,7 @@ class EntityBrowser extends ConfigEntityBase implements EntityBrowserInterface,
    */
   protected function widgetSelectorPluginCollection() {
     if (!$this->widgetSelectorCollection) {
-      $options = array();
+      $options = [];
       foreach ($this->getWidgets()->getInstanceIds() as $id) {
         $options[$id] = $this->getWidgets()->get($id)->label();
       }
@@ -435,12 +435,21 @@ class EntityBrowser extends ConfigEntityBase implements EntityBrowserInterface,
   /**
    * {@inheritdoc}
    */
-  public function save() {
-    $return = parent::save();
+  public function postSave(EntityStorageInterface $storage, $update = TRUE) {
+    parent::postSave($storage, $update);
     // Rebuild route information when browsers that register routes
     // are created/updated.
-    \Drupal::service('router.builder')->rebuild();
-    return $return;
+    \Drupal::service('router.builder')->setRebuildNeeded();
+  }
+
+  /**
+   * {@inheritdoc}
+   */
+  public static function postDelete(EntityStorageInterface $storage, array $entities) {
+    parent::postDelete($storage, $entities);
+    // Rebuild route information when browsers that register routes
+    // are deleted.
+    \Drupal::service('router.builder')->setRebuildNeeded();
   }
 
   /**