Exemplo n.º 1
0
  /**
   * {@inheritdoc}
   */
  public function calculateDependencies() {
    $dependencies = parent::calculateDependencies();

    if ($this->options['limit_queue']) {
      $queue = EntityQueue::load($this->options['limit_queue']);
      $dependencies[$queue->getConfigDependencyKey()][] = $queue->getConfigDependencyName();
    }

    return $dependencies;
  }
  /**
   * {@inheritdoc}
   */
  protected function checkCreateAccess(AccountInterface $account, array $context, $entity_bundle = NULL) {
    $access_result = AccessResult::allowedIfHasPermissions($account, ["create {$entity_bundle} entityqueue", 'manipulate all entityqueues', 'administer entityqueue'], 'OR');

    if ($entity_bundle) {
      $queue = EntityQueue::load($entity_bundle);
      $access_result = AccessResult::allowedIf(!$queue->getHandlerPlugin()->hasAutomatedSubqueues());
    }

    return $access_result;
  }
Exemplo n.º 3
0
 /**
  * {@inheritdoc}
  */
 public static function bundleFieldDefinitions(EntityTypeInterface $entity_type, $bundle, array $base_field_definitions) {
   // Change the target type of the 'items' field to the one defined by the
   // parent queue (i.e. bundle).
   if ($queue = EntityQueue::load($bundle)) {
     $fields['items'] = clone $base_field_definitions['items'];
     $fields['items']->setSetting('target_type', $queue->getTargetEntityTypeId());
     return $fields;
   }
   return [];
 }