/**
  * {@inheritdoc}
  */
 public function buildRow(EntityInterface $entity)
 {
     /* @var $entity \Drupal\scheduled_updates\Entity\ScheduledUpdate */
     $row['name'] = $this->l($entity->label(), new Url('entity.scheduled_update.edit_form', array('scheduled_update' => $entity->id())));
     $row['type'] = $this->updateUtils->getUpdateTypeLabel($entity);
     return $row + parent::buildRow($entity);
 }
Ejemplo n.º 2
0
 /**
  * Set a entity to use a new revision is applicable.
  *
  * @param \Drupal\Core\Entity\ContentEntityInterface $entity_to_update
  * @param \Drupal\scheduled_updates\ScheduledUpdateInterface $update
  */
 protected function setEntityRevision(ContentEntityInterface $entity_to_update, ScheduledUpdateInterface $update) {
   if ($this->updateUtils->isRevisionableUpdate($update)) {
     $new_revision = FALSE;
     $create_revisions = $this->configuration['create_revisions'];
     if ($create_revisions == UpdateRunnerInterface::REVISIONS_BUNDLE_DEFAULT) {
       $new_revision = $this->updateUtils->getRevisionDefault($entity_to_update);
     }
     elseif ($create_revisions == UpdateRunnerInterface::REVISIONS_YES) {
       $new_revision = TRUE;
     }
     $entity_to_update->setNewRevision($new_revision);
     if ($new_revision) {
       $this->updateUtils->setRevisionCreationTime($entity_to_update);
     }
   }
 }
 /**
  * Check to see if Updates attached to an entity has changed.
  *
  * @param \Drupal\Core\Entity\ContentEntityInterface $entity
  * @param \Drupal\scheduled_updates\Plugin\EntityMonitorUpdateRunnerInterface $runner
  *
  * @return bool
  */
 protected function entityUpdatesChanged(ContentEntityInterface $entity, EntityMonitorUpdateRunnerInterface $runner)
 {
     // We can't use $entity->original because it is not always the last revision.
     /** @var ContentEntityInterface $previous_revision */
     if ($previous_revision = $this->updateUtils->getPreviousRevision($entity)) {
         $field_ids = $runner->getReferencingFieldIds();
         foreach ($field_ids as $field_id) {
             $previous_update_ids = $runner->getEntityReferenceTargetIds($previous_revision, $field_id, TRUE);
             $updated_update_ids = $runner->getEntityReferenceTargetIds($entity, $field_id, TRUE);
             if ($previous_update_ids != $updated_update_ids) {
                 return TRUE;
             }
         }
     }
     return FALSE;
 }