protected function EmbeddedUpdateRunner::getUpdateIdsOnEntity in Scheduled Updates 8
Get all update ids for this connected Update type.
@todo Should results be cached per entity_id and revision_id to avoiding loading updates.
Parameters
\Drupal\Core\Entity\ContentEntityInterface $entity:
bool $include_inactive:
Return value
array
3 calls to EmbeddedUpdateRunner::getUpdateIdsOnEntity()
- EmbeddedUpdateRunner::deactivateUpdates in src/
Plugin/ UpdateRunner/ EmbeddedUpdateRunner.php - Deactivate any Scheduled Updates that are previous revision but not on current.
- EmbeddedUpdateRunner::getPreviousRevisionsWithUpdates in src/
Plugin/ UpdateRunner/ EmbeddedUpdateRunner.php - Get all previous revisions that have updates of the attached type.
- EmbeddedUpdateRunner::reactivateUpdates in src/
Plugin/ UpdateRunner/ EmbeddedUpdateRunner.php - Reactive any updates that are on this entity that have been deactived previously.
File
- src/
Plugin/ UpdateRunner/ EmbeddedUpdateRunner.php, line 155 - Contains \Drupal\scheduled_updates\Plugin\UpdateRunner\EmbeddedUpdateRunner.
Class
- EmbeddedUpdateRunner
- The default Embedded Update Runner.
Namespace
Drupal\scheduled_updates\Plugin\UpdateRunnerCode
protected function getUpdateIdsOnEntity(ContentEntityInterface $entity, $include_inactive = FALSE) {
$field_ids = $this
->getReferencingFieldIds();
$update_ids = [];
foreach ($field_ids as $field_id) {
$field_update_ids = $this
->getEntityReferenceTargetIds($entity, $field_id);
// This field could reference other update bundles
// remove any that aren't of the attached scheduled update type.
foreach ($field_update_ids as $field_update_id) {
$update = $this->entityTypeManager
->getStorage('scheduled_update')
->load($field_update_id);
if ($update && $update
->bundle() == $this->scheduled_update_type
->id()) {
if (!$include_inactive) {
if ($update->status->value == ScheduledUpdateInterface::STATUS_INACTIVE) {
continue;
}
}
$update_ids[$field_update_id] = $field_update_id;
}
}
}
return $update_ids;
}