You are here

class IndependentUpdateRunner in Scheduled Updates 8

The default Embedded Update Runner.

Plugin annotation


@UpdateRunner(
  id = "default_independent",
  label = @Translation("Default"),
  description = @Translation("Updates are created directly."),
  update_types = {"independent"}
)

Hierarchy

Expanded class hierarchy of IndependentUpdateRunner

File

src/Plugin/UpdateRunner/IndependentUpdateRunner.php, line 27
Contains \Drupal\scheduled_updates\Plugin\UpdateRunner\IndependentUpdateRunner.

Namespace

Drupal\scheduled_updates\Plugin\UpdateRunner
View source
class IndependentUpdateRunner extends BaseUpdateRunner implements UpdateRunnerInterface {

  /**
   * Get all scheduled updates that referencing entities via Entity Reference
   * Field
   *
   *  @return ScheduledUpdate[]
   */
  protected function getReferencingUpdates() {
    $updates = [];
    $update_ids = $this
      ->getReadyUpdateIds();
    foreach ($update_ids as $update_id) {
      $updates[] = [
        'update_id' => $update_id,
        'entity_type' => $this
          ->updateEntityType(),
      ];
    }
    return $updates;
  }

  /**
   * {@inheritdoc}
   */
  protected function getAllUpdates() {
    return $this
      ->getReferencingUpdates();
  }

  /**
   * {@inheritdoc}
   */
  public function buildConfigurationForm(array $form, FormStateInterface $form_state) {
    $form = parent::buildConfigurationForm($form, $form_state);
    if ($update_type = $this
      ->getUpdateType($form_state)) {
      $settings = $form_state
        ->get('update_runner');
      $bundles = isset($settings['bundles']) ? array_filter($settings['bundles']) : [];
      if ($entity_type = $update_type
        ->getUpdateEntityType()) {
        $form['bundles'] = [
          '#type' => 'checkboxes',
          '#title' => $this
            ->bundleLabel($entity_type),
          '#options' => $this->updateUtils
            ->bundleOptions($entity_type),
          '#default_value' => $bundles,
          '#required' => TRUE,
        ];
      }
    }
    return $form;
  }

}

Members

Namesort descending Modifiers Type Description Overrides
BaseUpdateRunner::$accountSwitcher protected property
BaseUpdateRunner::$entityTypeManager protected property @var \Drupal\Core\Entity\EntityTypeManagerInterface
BaseUpdateRunner::$fieldManager protected property @var \Drupal\Core\Entity\EntityFieldManagerInterface
BaseUpdateRunner::$field_ids protected property The entity reference field ids target connected update types.
BaseUpdateRunner::$isRunByCron protected property If the runner is currently run by cron.
BaseUpdateRunner::$isUserSwitched protected property If the runner is currently switched to a different user.
BaseUpdateRunner::$items_to_release protected property Queue items that will be released after updates in queue are run.
BaseUpdateRunner::$scheduled_update_type protected property @var \Drupal\scheduled_updates\entity\ScheduledUpdateType
BaseUpdateRunner::$updateUtils protected property
BaseUpdateRunner::addActiveUpdateConditions protected function Add conditions to a query to select updates to run.
BaseUpdateRunner::addItemToRelease protected function
BaseUpdateRunner::addUpdatesToQueue public function Add all updates to queue. Overrides UpdateRunnerInterface::addUpdatesToQueue
BaseUpdateRunner::create public static function Creates an instance of the plugin. Overrides ContainerFactoryPluginInterface::create
BaseUpdateRunner::displayMessage protected function Display message about updates.
BaseUpdateRunner::getAfterRun public function Get After Run behavior configuration.
BaseUpdateRunner::getDescription public function Get the description of the Runner Plugin. Overrides UpdateRunnerInterface::getDescription 1
BaseUpdateRunner::getEntityIdsReferencingReadyUpdates protected function Get all entity ids for entities that reference updates that are ready to run. 1
BaseUpdateRunner::getEntityReferenceTargetIds public function Get target entity ids for an entity reference field on a entity. Overrides UpdateRunnerInterface::getEntityReferenceTargetIds
BaseUpdateRunner::getInvalidUpdateBehavior public function Get how this runner should handle invalid entity updates. Overrides UpdateRunnerInterface::getInvalidUpdateBehavior
BaseUpdateRunner::getQueue public function Get the Queue for this Update Runner. Overrides UpdateRunnerInterface::getQueue
BaseUpdateRunner::getReadyUpdateIds protected function Get updates that are ready to be run for this Runner.
BaseUpdateRunner::getReferencingFieldIds public function Get all field ids that are attached to the entity type to be updated and target this update type. Overrides UpdateRunnerInterface::getReferencingFieldIds
BaseUpdateRunner::getUpdateType protected function Get Scheduled Update Type from the Form State.
BaseUpdateRunner::isRunByCron public function @inheritdoc Overrides UpdateRunnerInterface::isRunByCron
BaseUpdateRunner::loadEntitiesToUpdate protected function Load multi entities to update. 1
BaseUpdateRunner::prepareEntityForUpdate protected function Prepare an entity to be updated.
BaseUpdateRunner::releaseClaimedItems protected function
BaseUpdateRunner::removeUpdate protected function Remove update from reference field value.
BaseUpdateRunner::runUpdate protected function Run an individual update from the queue.
BaseUpdateRunner::runUpdatesInQueue public function Run all updates that are in the queue. Overrides UpdateRunnerInterface::runUpdatesInQueue
BaseUpdateRunner::setEntityRevision protected function Set a entity to use a new revision is applicable.
BaseUpdateRunner::setRunByCron public function @inheritdoc Overrides UpdateRunnerInterface::setRunByCron
BaseUpdateRunner::submitConfigurationForm public function Form submission handler. Overrides PluginFormInterface::submitConfigurationForm
BaseUpdateRunner::switchUser protected function Switch to another user to run an update if necessary.
BaseUpdateRunner::switchUserBack protected function If the user has been switch to run an update switch the user back.
BaseUpdateRunner::transferFieldValues protected function Transfer field values from update to entity to be updated.
BaseUpdateRunner::updateEntityType public function Return the entity id of the entity type being updated. Overrides UpdateRunnerInterface::updateEntityType
BaseUpdateRunner::validateConfigurationForm public function Form validation handler. Overrides PluginFormInterface::validateConfigurationForm 1
BaseUpdateRunner::__construct public function BaseUpdateRunner constructor. Overrides PluginBase::__construct
ClassUtilsTrait::bundleLabel protected function
ClassUtilsTrait::definitionClassImplementsInterface protected function Determines if the class for an entity type definition implements and interface.
ClassUtilsTrait::entityLabel protected function
ClassUtilsTrait::entityTypeManager protected function
ClassUtilsTrait::getEntityOwner protected function Get the entity owner if applicable.
ClassUtilsTrait::getRevisionOwner protected function Get the revision owner for an ContentEntity.
ClassUtilsTrait::implementsInterface protected function Determines if an object or class name implements any interfaces in a list.
ClassUtilsTrait::revisionOwnerInterfaces protected function Get class names of interfaces that support revision ownership.
ClassUtilsTrait::targetSupportBundles protected function
ClassUtilsTrait::targetTypeBundleLabel protected function
ClassUtilsTrait::targetTypeLabel public function
ClassUtilsTrait::typeSupportsBundles protected function
DependencySerializationTrait::$_entityStorages protected property An array of entity type IDs keyed by the property name of their storages.
DependencySerializationTrait::$_serviceIds protected property An array of service IDs keyed by property name used for serialization.
DependencySerializationTrait::__sleep public function 1
DependencySerializationTrait::__wakeup public function 2
IndependentUpdateRunner::buildConfigurationForm public function Form constructor. Overrides BaseUpdateRunner::buildConfigurationForm
IndependentUpdateRunner::getAllUpdates protected function Get all schedule updates for this types that should be added to queue. Overrides BaseUpdateRunner::getAllUpdates
IndependentUpdateRunner::getReferencingUpdates protected function Get all scheduled updates that referencing entities via Entity Reference Field
MessengerTrait::$messenger protected property The messenger. 29
MessengerTrait::messenger public function Gets the messenger. 29
MessengerTrait::setMessenger public function Sets the messenger.
PluginBase::$configuration protected property Configuration information passed into the plugin. 1
PluginBase::$pluginDefinition protected property The plugin implementation definition. 1
PluginBase::$pluginId protected property The plugin_id.
PluginBase::DERIVATIVE_SEPARATOR constant A string which is used to separate base plugin IDs from the derivative ID.
PluginBase::getBaseId public function Gets the base_plugin_id of the plugin instance. Overrides DerivativeInspectionInterface::getBaseId
PluginBase::getDerivativeId public function Gets the derivative_id of the plugin instance. Overrides DerivativeInspectionInterface::getDerivativeId
PluginBase::getPluginDefinition public function Gets the definition of the plugin implementation. Overrides PluginInspectionInterface::getPluginDefinition 3
PluginBase::getPluginId public function Gets the plugin_id of the plugin instance. Overrides PluginInspectionInterface::getPluginId
PluginBase::isConfigurable public function Determines if the plugin is configurable.
StringTranslationTrait::$stringTranslation protected property The string translation service. 1
StringTranslationTrait::formatPlural protected function Formats a string containing a count of items.
StringTranslationTrait::getNumberOfPlurals protected function Returns the number of plurals supported by a given language.
StringTranslationTrait::getStringTranslation protected function Gets the string translation service.
StringTranslationTrait::setStringTranslation public function Sets the string translation service to use. 2
StringTranslationTrait::t protected function Translates a string to the current language or to a given language.
UpdateRunnerInterface::AFTER_ARCHIVE constant
UpdateRunnerInterface::AFTER_DELETE constant
UpdateRunnerInterface::INVALID_ARCHIVE constant
UpdateRunnerInterface::INVALID_DELETE constant
UpdateRunnerInterface::INVALID_REQUEUE constant
UpdateRunnerInterface::REVISIONS_BUNDLE_DEFAULT constant
UpdateRunnerInterface::REVISIONS_NO constant
UpdateRunnerInterface::REVISIONS_YES constant
UpdateRunnerInterface::USER_OWNER constant
UpdateRunnerInterface::USER_REVISION_OWNER constant
UpdateRunnerInterface::USER_UPDATE_OWNER constant
UpdateRunnerInterface::USER_UPDATE_RUNNER constant