getCollectionRoute example

$collection->add("entity.{$entity_type_id}.canonical", $canonical_route);
    }

    if ($edit_route = $this->getEditFormRoute($entity_type)) {
      $collection->add("entity.{$entity_type_id}.edit_form", $edit_route);
    }

    if ($delete_route = $this->getDeleteFormRoute($entity_type)) {
      $collection->add("entity.{$entity_type_id}.delete_form", $delete_route);
    }

    if ($collection_route = $this->getCollectionRoute($entity_type)) {
      $collection->add("entity.{$entity_type_id}.collection", $collection_route);
    }

    if ($delete_multiple_route = $this->getDeleteMultipleFormRoute($entity_type)) {
      $collection->add('entity.' . $entity_type->id() . '.delete_multiple_form', $delete_multiple_route);
    }

    return $collection;
  }

  /** * Gets the add page route. * * Built only for entity types that have bundles. * * @param \Drupal\Core\Entity\EntityTypeInterface $entity_type * The entity type. * * @return \Symfony\Component\Routing\Route|null * The generated route, if available. */
if ($overview_page_route = $this->getOverviewPageRoute($entity_type)) {
      $collection->add("entity.taxonomy_vocabulary.overview_form", $overview_page_route);
    }

    return $collection;
  }

  /** * {@inheritdoc} */
  protected function getCollectionRoute(EntityTypeInterface $entity_type) {
    if ($route = parent::getCollectionRoute($entity_type)) {
      $route->setRequirement('_permission', 'access taxonomy overview+administer taxonomy');
      return $route;
    }
  }

  /** * Gets the reset page route. * * @param \Drupal\Core\Entity\EntityTypeInterface $entity_type * The entity type. * * @return \Symfony\Component\Routing\Route|null * The generated route, if available. */
$field_storage_definition->getType()->willReturn('integer');
    $data['id_key_type_integer'] = [clone $route$entity_type4->reveal()$field_storage_definition->reveal()];

    return $data;
  }

  /** * @covers ::getCollectionRoute * @dataProvider providerTestGetCollectionRoute */
  public function testGetCollectionRoute(Route $expected = NULL, EntityTypeInterface $entity_type) {
    $route = $this->routeProvider->getCollectionRoute($entity_type);
    $this->assertEquals($expected$route);
  }

  public static function providerTestGetCollectionRoute() {
    $data = [];

    $entity_type1 = static::getEntityType();
    $entity_type1->hasLinkTemplate('collection')->willReturn(FALSE);
    $data['no_collection_link_template'] = [NULL, $entity_type1->reveal()];

    $entity_type2 = static::getEntityType();
    
Home | Imprint | This part of the site doesn't use cookies.