You are here

public function ManualPull::access in CMS Content Sync 8

Same name and namespace in other branches
  1. 2.1.x src/Controller/ManualPull.php \Drupal\cms_content_sync\Controller\ManualPull::access()
  2. 2.0.x src/Controller/ManualPull.php \Drupal\cms_content_sync\Controller\ManualPull::access()

Ensure that the pull tab is just show if a flow exists which contains and entity type that has its pull set to "manual".

1 string reference to 'ManualPull::access'
cms_content_sync.routing.yml in ./cms_content_sync.routing.yml
cms_content_sync.routing.yml

File

src/Controller/ManualPull.php, line 22

Class

ManualPull
Provides a listing of Flow.

Namespace

Drupal\cms_content_sync\Controller

Code

public function access() {
  $flows = Flow::getAll();
  $manually_pulled_entity_types = [];
  foreach ($flows as $flow) {
    if (!empty($flow
      ->getEntityTypesToPull(PullIntent::PULL_MANUALLY))) {
      $manually_pulled_entity_types[$flow
        ->id()] = $flow
        ->getEntityTypesToPull(PullIntent::PULL_MANUALLY);
    }
  }
  return AccessResult::allowedIf(!empty($manually_pulled_entity_types))
    ->addCacheableDependency($flows);
}