Browse Source

fix context definitions

d9_islandora
Eli Zoller 4 years ago
parent
commit
51158aa3ca
  1. 2
      src/ContextProvider/FileContextProvider.php
  2. 4
      src/ContextProvider/FileRouteContextProvider.php
  3. 2
      src/ContextProvider/MediaContextProvider.php
  4. 4
      src/ContextProvider/MediaRouteContextProvider.php
  5. 2
      src/ContextProvider/NodeContextProvider.php
  6. 2
      src/ContextProvider/TermContextProvider.php
  7. 4
      src/ContextProvider/TermRouteContextProvider.php

2
src/ContextProvider/FileContextProvider.php

@ -43,7 +43,7 @@ class FileContextProvider implements ContextProviderInterface {
* {@inheritdoc}
*/
public function getAvailableContexts() {
$context = EntityContext::fromEntityTypeId('entity:file', $this->t('File from entity hook'));
$context = EntityContext::fromEntityTypeId('file', $this->t('File from entity hook'));
return ['@islandora.file_route_context_provider:file' => $context];
}

4
src/ContextProvider/FileRouteContextProvider.php

@ -38,7 +38,7 @@ class FileRouteContextProvider implements ContextProviderInterface {
* {@inheritdoc}
*/
public function getRuntimeContexts(array $unqualified_context_ids) {
$context_definition = EntityContextDefinition::fromEntityTypeId('entity:file')->setLabel(NULL)->setRequired(FALSE);
$context_definition = EntityContextDefinition::fromEntityTypeId('file')->setLabel(NULL)->setRequired(FALSE);
$value = NULL;
@ -66,7 +66,7 @@ class FileRouteContextProvider implements ContextProviderInterface {
* {@inheritdoc}
*/
public function getAvailableContexts() {
$context = EntityContext::fromEntityTypeId('entity:file', $this->t('File from URL'));
$context = EntityContext::fromEntityTypeId('file', $this->t('File from URL'));
return ['file' => $context];
}

2
src/ContextProvider/MediaContextProvider.php

@ -43,7 +43,7 @@ class MediaContextProvider implements ContextProviderInterface {
* {@inheritdoc}
*/
public function getAvailableContexts() {
$context = EntityContext::fromEntityTypeId('entity:media', $this->t('Media from entity hook'));
$context = EntityContext::fromEntityType(\Drupal::entityTypeManager()->getDefinition('media'), $this->t('Media from URL'));
return ['@islandora.media_route_context_provider:media' => $context];
}

4
src/ContextProvider/MediaRouteContextProvider.php

@ -40,7 +40,7 @@ class MediaRouteContextProvider implements ContextProviderInterface {
*/
public function getRuntimeContexts(array $unqualified_context_ids) {
$result = [];
$context_definition = EntityContextDefinition::fromEntityTypeId('entity:media')->setLabel(NULL)->setRequired(FALSE);
$context_definition = EntityContextDefinition::fromEntityTypeId('media')->setLabel(NULL)->setRequired(FALSE);
$value = NULL;
// Hack the media out of the route.
@ -71,7 +71,7 @@ class MediaRouteContextProvider implements ContextProviderInterface {
* {@inheritdoc}
*/
public function getAvailableContexts() {
$context = EntityContext::fromEntityTypeId('entity:media', $this->t('Media from URL'));
$context = EntityContext::fromEntityType(\Drupal::entityTypeManager()->getDefinition('media'), $this->t('Media from URL'));
return ['media' => $context];
}

2
src/ContextProvider/NodeContextProvider.php

@ -43,7 +43,7 @@ class NodeContextProvider implements ContextProviderInterface {
* {@inheritdoc}
*/
public function getAvailableContexts() {
$context = EntityContext::fromEntityTypeId('entity:node', $this->t('Node from entity hook'));
$context = EntityContext::fromEntityTypeId('node', $this->t('Node from entity hook'));
return ['@node.node_route_context:node' => $context];
}

2
src/ContextProvider/TermContextProvider.php

@ -43,7 +43,7 @@ class TermContextProvider implements ContextProviderInterface {
* {@inheritdoc}
*/
public function getAvailableContexts() {
$context = EntityContext::fromEntityTypeId('entity:taxonomy_term', $this->t('Term from entity hook'));
$context = EntityContext::fromEntityTypeId('taxonomy_term', $this->t('Term from entity hook'));
return ['@islandora.taxonomy_term_route_context_provider:taxonomy_term' => $context];
}

4
src/ContextProvider/TermRouteContextProvider.php

@ -38,7 +38,7 @@ class TermRouteContextProvider implements ContextProviderInterface {
* {@inheritdoc}
*/
public function getRuntimeContexts(array $unqualified_context_ids) {
$context_definition = EntityContextDefinition::fromEntityTypeId('entity:taxonomy_term')->setLabel(NULL)->setRequired(FALSE);
$context_definition = EntityContextDefinition::fromEntityTypeId('taxonomy_term')->setLabel(NULL)->setRequired(FALSE);
$value = NULL;
// Hack the taxonomy term out of the route.
@ -65,7 +65,7 @@ class TermRouteContextProvider implements ContextProviderInterface {
* {@inheritdoc}
*/
public function getAvailableContexts() {
$context = EntityContext::fromEntityTypeId('entity:taxonomy_term', $this->t('Term from URL'));
$context = EntityContext::fromEntityTypeId('taxonomy_term', $this->t('Term from URL'));
return ['taxonomy_term' => $context];
}

Loading…
Cancel
Save