Ejemplo n.º 1
0
 public function handleEntity(array &$metadata = array())
 {
     $sitemap = xmlsitemap_link_load($this->original_entity->type(), $this->original_entity->id());
     if ($sitemap) {
         $resolver = new Resolver($this->original_entity, false);
         $resolver->resolveDependencies(false, $sitemap, false, 'xmlsitemap');
         $metadata['sitemap_definition'] = $resolver->resolvedDefinition();
     }
 }
 public function handleEntity(array &$metadata = array())
 {
     $metadata['webform_validation']['processed'] = true;
     $metadata['webform_validation']['rules'] = array();
     $validation = webform_validation_get_node_rules($this->original_entity->id());
     if ($validation) {
         $resolver = new Resolver($this->original_entity, false);
         $resolver->resolveDependencies(false, $validation, false, 'webform_validation');
         $metadata['webform_validation']['rules'] = $resolver->resolvedDefinition();
     }
 }
Ejemplo n.º 3
0
 public function diff()
 {
     // Get the preparer registry.
     $preparer_registry = new PreparerRegistry();
     if (!$this->revisions_table) {
         // Prepare the entity.
         $preparer_registry->beforeSend($this->entity);
         $resolver = new Resolver($this->entity);
         return array($this->entity->vuuid() => array('additions' => $resolver->resolvedDefinition(), 'deletions' => array()));
     }
     // Get the revisions in between the two mentioned. If the old is blank, get the entire history.
     $revision_ids = $this->getRevisionHistory($this->old_revision_id, $this->new_revision_id);
     if ($revision_ids === false) {
         return false;
     }
     $payload = array();
     $before_id = $this->old_revision_id ? $this->old_revision_id : -1;
     foreach ($revision_ids as $current_id) {
         // Load the entities.
         if ($before_id === -1) {
             $old_entity = null;
         } else {
             $old_entity = clone $this->entity;
             $old_entity->setRevision($before_id);
         }
         $new_entity = clone $this->entity;
         $new_entity->setRevision($current_id);
         // Pass the entity through the preparers to add any additional field metadata.
         if ($old_entity !== null) {
             $preparer_registry->beforeSend($old_entity);
         }
         $preparer_registry->beforeSend($new_entity);
         $payload[$current_id . '|' . $new_entity->vuuid()] = $this->singleDiff($old_entity, $new_entity);
         // Update the before ID.
         $before_id = $current_id;
     }
     return $payload;
 }