You are here

public function TaxonomyMenu::save in Zircon Profile 8.0

Same name and namespace in other branches
  1. 8 modules/taxonomy_menu/src/Entity/TaxonomyMenu.php \Drupal\taxonomy_menu\Entity\TaxonomyMenu::save()

Saves an entity permanently.

When saving existing entities, the entity is assumed to be complete, partial updates of entities are not supported.

Return value

int Either SAVED_NEW or SAVED_UPDATED, depending on the operation performed.

Throws

\Drupal\Core\Entity\EntityStorageException In case of failures an exception is thrown.

Overrides ConfigEntityBase::save

File

modules/taxonomy_menu/src/Entity/TaxonomyMenu.php, line 104
Contains Drupal\taxonomy_menu\Entity\TaxonomyMenu.

Class

TaxonomyMenu
Defines the TaxonomyMenu entity.

Namespace

Drupal\taxonomy_menu\Entity

Code

public function save() {

  // Make sure we don't have any save exceptions before building menu
  // definitions.
  $return = parent::save();
  foreach ($this
    ->getLinks([], TRUE) as $link_key => $link_def) {
    $this
      ->getMenuLinkManager()
      ->addDefinition($link_key, $link_def);
  }
  return $return;
}