You are here

public function Template::save in Wysiwyg API template plugin 3.0.x

Same name and namespace in other branches
  1. 8.2 src/Entity/Template.php \Drupal\wysiwyg_template\Entity\Template::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

src/Entity/Template.php, line 163

Class

Template
Defines the Template entity.

Namespace

Drupal\wysiwyg_template\Entity

Code

public function save() {
  $this->node_types = array_values(array_filter($this
    ->getNodeTypes()));
  foreach ($this
    ->getBundles() as $type) {
    $this->entity_types[$type] = array_values(array_filter($this
      ->getBundles($type)));
  }
  parent::save();
}