/**
  * {@inheritdoc}
  */
 public function postSave(EntityStorageInterface $storage, $update = TRUE)
 {
     parent::postSave($storage, $update);
     if (!$update && !$this->isSyncing()) {
         block_content_add_body_field($this->id);
     }
 }
 /**
  * {@inheritdoc}
  */
 public function postSave(EntityStorageInterface $storage, $update = TRUE)
 {
     parent::postSave($storage, $update);
     if (!$update && !$this->isSyncing()) {
         entity_invoke_bundle_hook('create', 'block_content', $this->id());
         if (!$this->isSyncing()) {
             block_content_add_body_field($this->id);
         }
     } elseif ($this->getOriginalId() != $this->id) {
         entity_invoke_bundle_hook('rename', 'block_content', $this->getOriginalId(), $this->id);
     }
 }
Beispiel #3
0
 /**
  * {@inheritdoc}
  */
 public function postSave(EntityStorageInterface $storage, $update = TRUE)
 {
     parent::postSave($storage, $update);
     if (!$update && !$this->isSyncing()) {
         // Save a new shortcut set with links copied from the user's default set.
         $default_set = shortcut_default_set();
         // This is the default set, do not copy shortcuts.
         if ($default_set->id() != $this->id()) {
             foreach ($default_set->getShortcuts() as $shortcut) {
                 $shortcut = $shortcut->createDuplicate();
                 $shortcut->enforceIsNew();
                 $shortcut->shortcut_set->target_id = $this->id();
                 $shortcut->save();
             }
         }
     }
 }
Beispiel #4
0
 /**
  * {@inheritdoc}
  */
 public function postSave(EntityStorageInterface $storage, $update = TRUE)
 {
     parent::postSave($storage, $update);
     if ($update && $this->getOriginalId() != $this->id() && !$this->isSyncing()) {
         // Reflect machine name changes in the definitions of existing 'taxonomy'
         // fields.
         $field_ids = array();
         $field_map = \Drupal::entityManager()->getFieldMapByFieldType('entity_reference');
         foreach ($field_map as $entity_type => $field_storages) {
             foreach ($field_storages as $field_storage => $info) {
                 $field_ids[] = $entity_type . '.' . $field_storage;
             }
         }
         $field_storages = \Drupal::entityManager()->getStorage('field_storage_config')->loadMultiple($field_ids);
         $taxonomy_fields = array_filter($field_storages, function ($field_storage) {
             return $field_storage->getType() == 'entity_reference' && $field_storage->getSetting('target_type') == 'taxonomy_term';
         });
         foreach ($taxonomy_fields as $field_storage) {
             $update_storage = FALSE;
             $allowed_values = $field_storage->getSetting('allowed_values');
             foreach ($allowed_values as &$value) {
                 if ($value['vocabulary'] == $this->getOriginalId()) {
                     $value['vocabulary'] = $this->id();
                     $update_storage = TRUE;
                 }
             }
             $field_storage->setSetting('allowed_values', $allowed_values);
             if ($update_storage) {
                 $field_storage->save();
             }
         }
     }
     $storage->resetCache($update ? array($this->getOriginalId()) : array());
 }
Beispiel #5
0
 /**
  * {@inheritdoc}
  */
 public function postSave(EntityStorageInterface $storage, $update = TRUE)
 {
     parent::postSave($storage, $update);
     if ($update && $this->getOriginalId() != $this->id()) {
         $update_count = node_type_update_nodes($this->getOriginalId(), $this->id());
         if ($update_count) {
             drupal_set_message(\Drupal::translation()->formatPlural($update_count, 'Changed the content type of 1 post from %old-type to %type.', 'Changed the content type of @count posts from %old-type to %type.', array('%old-type' => $this->getOriginalId(), '%type' => $this->id())));
         }
     }
     if ($update) {
         // Clear the cached field definitions as some settings affect the field
         // definitions.
         $this->entityManager()->clearCachedFieldDefinitions();
     }
 }
Beispiel #6
0
 /**
  * {@inheritdoc}
  */
 public function postSave(EntityStorageInterface $storage, $update = TRUE)
 {
     parent::postSave($storage, $update);
     if (!$update) {
         // Create a body if the create_body property is true and we're not in
         // the syncing process.
         if ($this->get('create_body') && !$this->isSyncing()) {
             $label = $this->get('create_body_label');
             node_add_body_field($this, $label);
         }
     } elseif ($this->getOriginalId() != $this->id()) {
         $update_count = node_type_update_nodes($this->getOriginalId(), $this->id());
         if ($update_count) {
             drupal_set_message(format_plural($update_count, 'Changed the content type of 1 post from %old-type to %type.', 'Changed the content type of @count posts from %old-type to %type.', array('%old-type' => $this->getOriginalId(), '%type' => $this->id())));
         }
     }
     if ($update) {
         // Clear the cached field definitions as some settings affect the field
         // definitions.
         $this->entityManager()->clearCachedFieldDefinitions();
     }
 }
 /**
  * {@inheritdoc}
  */
 public function postSave(EntityStorageInterface $storage, $update = TRUE)
 {
     parent::postSave($storage, $update);
     if (!$update && !$this->isSyncing()) {
         \Drupal::service('comment.manager')->addBodyField($this->id());
     }
 }
Beispiel #8
0
 /**
  * {@inheritdoc}
  */
 public function postSave(EntityStorageInterface $storage, $update = TRUE)
 {
     parent::postSave($storage, $update);
     // @todo Setting ->setRebuildNeeded isn't enough. Investigate.
     \Drupal::service('router.builder')->rebuild();
 }
Beispiel #9
0
  /**
   * {@inheritdoc}
   */
  public function postSave(EntityStorageInterface $storage, $update = TRUE) {
    parent::postSave($storage, $update);

    $this->getHandlerPlugin()->onQueuePostSave($this, $storage, $update);
  }
Beispiel #10
0
 /**
  * {@inheritdoc}
  */
 public function postSave(EntityStorageInterface $storage, $update = TRUE)
 {
     parent::postSave($storage, $update);
     if ($update) {
         // Clear the cached field definitions as some settings affect the field
         // definitions.
         $this->entityManager()->clearCachedFieldDefinitions();
     }
 }
Beispiel #11
0
 /**
  * {@inheritdoc}
  */
 public function postSave(EntityStorageInterface $storage, $update = TRUE)
 {
     parent::postSave($storage, $update);
     if (!$update) {
         // Clear the queue worker plugin cache so that our derivaties will be found.
         \Drupal::service('plugin.manager.queue_worker')->clearCachedDefinitions();
         \Drupal::queue('feeds_feed_import:' . $this->id())->createQueue();
     }
 }
Beispiel #12
0
 /**
  * {@inheritdoc}
  */
 public function postSave(EntityStorageInterface $storage, $update = TRUE)
 {
     parent::postSave($storage, $update);
     if ($update && $this->getOriginalId() != $this->id() && !$this->isSyncing()) {
         // Reflect machine name changes in the definitions of existing 'taxonomy'
         // fields.
         $field_ids = array();
         $field_map = \Drupal::entityManager()->getFieldMap();
         foreach ($field_map as $entity_type => $fields) {
             foreach ($fields as $field => $info) {
                 if ($info['type'] == 'taxonomy_term_reference') {
                     $field_ids[] = $entity_type . '.' . $field;
                 }
             }
         }
         $fields = \Drupal::entityManager()->getStorage('field_storage_config')->loadMultiple($field_ids);
         foreach ($fields as $field) {
             $update_field = FALSE;
             foreach ($field->settings['allowed_values'] as &$value) {
                 if ($value['vocabulary'] == $this->getOriginalId()) {
                     $value['vocabulary'] = $this->id();
                     $update_field = TRUE;
                 }
             }
             if ($update_field) {
                 $field->save();
             }
         }
     }
     $storage->resetCache($update ? array($this->getOriginalId()) : array());
 }