/** * {@inheritdoc} */ public function getDerivativeDefinitions($base_plugin_definition) { foreach ($this->pluginSelectorManager->getDefinitions() as $plugin_id => $plugin_definition) { $this->derivatives[$plugin_id] = array('description' => isset($plugin_definition['description']) ? $plugin_definition['description'] : NULL, 'label' => $plugin_definition['label'], 'plugin_selector_id' => $plugin_id) + $base_plugin_definition; } return parent::getDerivativeDefinitions($base_plugin_definition); }
/** * {@inheritdoc} */ public function getDerivativeDefinitions($base_plugin_definition) { $this->derivatives = []; /** @var \Drupal\rng\Entity\EventType[] $event_types */ foreach ($this->eventManager->getEventTypes() as $entity_type => $event_types) { $cache_tags = $this->entityManager->getDefinition($entity_type)->getListCacheTags(); foreach ($event_types as $event_type) { $cache_tags = Cache::mergeTags($cache_tags, $event_type->getCacheTags()); } // Only need one set of tasks task per entity type. if ($this->routeProvider->getRouteByName("entity.{$entity_type}.canonical")) { $event_default = "rng.event.{$entity_type}.event.default"; $this->derivatives[$event_default] = array('title' => t('Event'), 'base_route' => "entity.{$entity_type}.canonical", 'route_name' => "rng.event.{$entity_type}.event", 'weight' => 30, 'cache_tags' => $cache_tags); $this->derivatives["rng.event.{$entity_type}.event.settings"] = array('title' => t('Settings'), 'route_name' => $this->derivatives[$event_default]['route_name'], 'parent_id' => 'rng.local_tasks:' . $event_default, 'weight' => 10, 'cache_tags' => $cache_tags); $this->derivatives["rng.event.{$entity_type}.event.access"] = array('title' => t('Access'), 'route_name' => "rng.event.{$entity_type}.access", 'parent_id' => 'rng.local_tasks:' . $event_default, 'weight' => 20, 'cache_tags' => $cache_tags); $this->derivatives["rng.event.{$entity_type}.event.messages"] = array('title' => t('Messages'), 'route_name' => "rng.event.{$entity_type}.messages", 'parent_id' => 'rng.local_tasks:' . $event_default, 'weight' => 30, 'cache_tags' => $cache_tags); $this->derivatives["rng.event.{$entity_type}.event.group.list"] = array('title' => t('Groups'), 'route_name' => "rng.event.{$entity_type}.group.list", 'parent_id' => 'rng.local_tasks:' . $event_default, 'weight' => 40, 'cache_tags' => $cache_tags); $this->derivatives["rng.event.{$entity_type}.register.type_list"] = array('route_name' => "rng.event.{$entity_type}.register.type_list", 'base_route' => "entity.{$entity_type}.canonical", 'title' => t('Register'), 'weight' => 40, 'cache_tags' => $cache_tags); } } foreach ($this->derivatives as &$entry) { $entry += $base_plugin_definition; } return parent::getDerivativeDefinitions($base_plugin_definition); }
/** * {@inheritdoc} */ public function getDerivativeDefinitions($base_plugin_definition) { foreach ($this->pluginTypeManager->getPluginTypes() as $plugin_type) { if ($plugin_type->isFieldType()) { $this->derivatives[$plugin_type->getId()] = array('description' => $plugin_type->getDescription(), 'label' => $plugin_type->getLabel(), 'plugin_type_id' => $plugin_type->getId()) + $base_plugin_definition; } } return parent::getDerivativeDefinitions($base_plugin_definition); }
/** * {@inheritdoc} */ public function getDerivativeDefinitions($base_plugin_definition) { /** @var \Drupal\payment\Entity\PaymentStatusInterface[] $statuses */ $statuses = $this->paymentStatusStorage->loadMultiple(); foreach ($statuses as $status) { $this->derivatives[$status->id()] = array('description' => $status->getDescription(), 'label' => $status->label(), 'parent_id' => $status->getParentId()) + $base_plugin_definition; } return parent::getDerivativeDefinitions($base_plugin_definition); }
/** * {@inheritdoc} */ public function getDerivativeDefinitions($base_plugin_definition) { $block_contents = entity_load_multiple('block_content'); foreach ($block_contents as $block_content) { $this->derivatives[$block_content->uuid()] = $base_plugin_definition; $this->derivatives[$block_content->uuid()]['admin_label'] = $block_content->label(); } return parent::getDerivativeDefinitions($base_plugin_definition); }
/** * {@inheritdoc} */ public function getDerivativeDefinitions($base_plugin_definition) { // Create tabs for all possible entity types. foreach ($this->contentTranslationManager->getSupportedEntityTypes() as $entity_type_id => $entity_type) { // Find the route name for the translation overview. $translation_route_name = $entity_type->getLinkTemplate('drupal:content-translation-overview'); $this->derivatives[$translation_route_name] = array('entity_type' => $entity_type_id, 'title' => 'Translate', 'route_name' => $translation_route_name, 'base_route' => $entity_type->getLinkTemplate('canonical')) + $base_plugin_definition; } return parent::getDerivativeDefinitions($base_plugin_definition); }
/** * {@inheritdoc} */ public function getDerivativeDefinitions($base_plugin_definition) { foreach ($this->entityManager->getDefinitions() as $entity_type_id => $entity_type) { $this->derivatives[$entity_type_id] = $base_plugin_definition; $this->derivatives[$entity_type_id]['entity_types'] = array($entity_type_id); $this->derivatives[$entity_type_id]['label'] = t('@entity_type selection', array('@entity_type' => $entity_type->getLabel())); $this->derivatives[$entity_type_id]['base_plugin_label'] = (string) $base_plugin_definition['label']; } return parent::getDerivativeDefinitions($base_plugin_definition); }
/** * {@inheritdoc} */ public function getDerivativeDefinitions($base_plugin_definition) { // Create contextual links for translatable entity types. foreach ($this->contentTranslationManager->getSupportedEntityTypes() as $entity_type_id => $entity_type) { $this->derivatives[$entity_type_id]['title'] = t('Translate'); $this->derivatives[$entity_type_id]['route_name'] = "entity.{$entity_type_id}.content_translation_overview"; $this->derivatives[$entity_type_id]['group'] = $entity_type_id; } return parent::getDerivativeDefinitions($base_plugin_definition); }
/** * {@inheritdoc} */ public function getDerivativeDefinitions($base_plugin_definition) { $supported_entities = array('comment', 'file', 'node', 'taxonomy_term', 'user'); foreach (\Drupal::entityManager()->getDefinitions() as $entity_type_id => $entity_type) { if (!in_array($entity_type_id, $supported_entities)) { $this->derivatives[$entity_type_id] = $base_plugin_definition; $this->derivatives[$entity_type_id]['label'] = t('@entity_type selection', array('@entity_type' => $entity_type->getLabel())); } } return parent::getDerivativeDefinitions($base_plugin_definition); }
/** * {@inheritdoc} */ public function getDerivativeDefinitions($base_plugin_definition) { // Create tabs for all possible entity types. foreach ($this->contentTranslationManager->getSupportedEntityTypes() as $entity_type_id => $entity_type) { // Find the route name for the translation overview. $translation_route_name = "entity.{$entity_type_id}.content_translation_overview"; $base_route_name = "entity.{$entity_type_id}.canonical"; $this->derivatives[$translation_route_name] = array('entity_type' => $entity_type_id, 'title' => $this->t('Translate'), 'route_name' => $translation_route_name, 'base_route' => $base_route_name) + $base_plugin_definition; } return parent::getDerivativeDefinitions($base_plugin_definition); }
/** * {@inheritdoc} */ public function getDerivativeDefinitions($base_plugin_definition) { $block_contents = $this->blockContentStorage->loadMultiple(); /** @var $block_content \Drupal\block_content\Entity\BlockContent */ foreach ($block_contents as $block_content) { $this->derivatives[$block_content->uuid()] = $base_plugin_definition; $this->derivatives[$block_content->uuid()]['admin_label'] = $block_content->label(); $this->derivatives[$block_content->uuid()]['config_dependencies']['content'] = array($block_content->getConfigDependencyName()); } return parent::getDerivativeDefinitions($base_plugin_definition); }
/** * {@inheritdoc} */ public function getDerivativeDefinitions($base_plugin_definition) { $this->derivatives = array(); $types = entity_test_entity_types(); foreach ($types as $entity_type) { $this->derivatives[$entity_type] = array(); $this->derivatives[$entity_type]['base_route'] = "entity_test.edit_{$entity_type}"; $this->derivatives[$entity_type]['route_name'] = "entity_test.edit_{$entity_type}"; $this->derivatives[$entity_type]['title'] = 'Edit'; } return parent::getDerivativeDefinitions($base_plugin_definition); }
/** * {@inheritdoc} */ public function getDerivativeDefinitions($base_plugin_definition) { $views_data = Views::viewsData(); $base_tables = array_keys($views_data->fetchBaseTables()); $this->derivatives = array(); foreach ($base_tables as $table) { $views_info = $views_data->get($table); if (empty($views_info['table']['wizard_id'])) { $this->derivatives[$table] = array('id' => 'standard', 'base_table' => $table, 'title' => $views_info['table']['base']['title'], 'class' => 'Drupal\\views\\Plugin\\views\\wizard\\Standard'); } } return parent::getDerivativeDefinitions($base_plugin_definition); }
/** * {@inheritdoc} */ public function getDerivativeDefinitions($base_plugin_definition) { $this->derivatives = array(); $this->derivatives['devel_entity_test_canonical.canonical'] = array(); $this->derivatives['devel_entity_test_canonical.canonical']['base_route'] = "entity.devel_entity_test_canonical.canonical"; $this->derivatives['devel_entity_test_canonical.canonical']['route_name'] = "entity.devel_entity_test_canonical.canonical"; $this->derivatives['devel_entity_test_canonical.canonical']['title'] = 'View'; $this->derivatives['devel_entity_test_edit.edit'] = array(); $this->derivatives['devel_entity_test_edit.edit']['base_route'] = "entity.devel_entity_test_edit.edit_form"; $this->derivatives['devel_entity_test_edit.edit']['route_name'] = "entity.devel_entity_test_edit.edit_form"; $this->derivatives['devel_entity_test_edit.edit']['title'] = 'Edit'; return parent::getDerivativeDefinitions($base_plugin_definition); }
/** * {@inheritdoc} */ public function getDerivativeDefinitions($base_plugin_definition) { if (empty($this->derivatives)) { $definitions = []; foreach ($this->getParticipatingEntityTypes() as $entity_type_id => $entity_type) { $definition = $base_plugin_definition; $definition['label'] = t('Delete @entity_type', ['@entity_type' => $entity_type->getLowercaseLabel()]); $definition['type'] = $entity_type_id; $definition['confirm_form_route_name'] = 'entity.' . $entity_type_id . '.delete_multiple_form'; $definitions[$entity_type_id] = $definition; } $this->derivatives = $definitions; } return parent::getDerivativeDefinitions($base_plugin_definition); }
/** * {@inheritdoc} */ public function getDerivativeDefinitions($base_plugin_definition) { foreach ($this->entityManager->getDefinitions() as $entity_type_id => $entity_type) { $has_canonical = $entity_type->hasLinkTemplate('canonical'); if ($has_canonical) { $this->derivatives[$entity_type_id] = $base_plugin_definition; $this->derivatives[$entity_type_id]['id'] = $base_plugin_definition['id'] . ':' . $entity_type_id; $this->derivatives[$entity_type_id]['label'] = $entity_type->getLabel(); $this->derivatives[$entity_type_id]['target_entity'] = $entity_type_id; $this->derivatives[$entity_type_id]['base_plugin_label'] = (string) $base_plugin_definition['label']; } } return parent::getDerivativeDefinitions($base_plugin_definition); }
/** * {@inheritdoc} */ public function getDerivativeDefinitions($base_plugin_definition) { $exclude = ['node']; $this->derivatives = []; foreach ($this->entityTypeManager->getDefinitions() as $entity_type_id => $entity_type) { if (in_array($entity_type_id, $exclude)) { continue; } if (!$entity_type->hasLinkTemplate('version-history')) { continue; } $this->derivatives[$entity_type_id] = ['route_name' => "entity.{$entity_type_id}.version_history", 'title' => 'Revisions', 'base_route' => "entity.{$entity_type_id}.canonical", 'weight' => 20] + $base_plugin_definition; } return parent::getDerivativeDefinitions($base_plugin_definition); }
/** * {@inheritdoc} */ public function getDerivativeDefinitions($base_plugin_definition) { $node_types = simplenews_get_content_types(); $node_type = reset($node_types); if (count($node_types) == 1) { $label = NodeType::load($node_type)->label(); $this->derivatives[$node_type] = $base_plugin_definition; $this->derivatives[$node_type]['title'] = new TranslationWrapper('Add @label', array('@label' => $label)); $this->derivatives[$node_type]['route_parameters'] = array('node_type' => $node_type); } elseif (count($node_types) > 1) { $base_plugin_definition['route_name'] = 'node.add_page'; $base_plugin_definition['title'] = new TranslationWrapper('Add content'); $this->derivatives[] = $base_plugin_definition; } return parent::getDerivativeDefinitions($base_plugin_definition); }
/** * {@inheritdoc} */ public function getDerivativeDefinitions($base_plugin_definition) { $mappers = $this->mapperManager->getMappers(); foreach ($mappers as $plugin_id => $mapper) { /** @var \Drupal\content_tab\ContentTabMapperInterface $mapper */ $route_name = $mapper->getOverviewRouteName(); $base_route = $mapper->getBaseRouteName(); if (!empty($base_route)) { $this->derivatives[$route_name] = $base_plugin_definition; $this->derivatives[$route_name]['content_tab_plugin_id'] = $plugin_id; $this->derivatives[$route_name]['class'] = '\Drupal\content_tab\Plugin\Menu\LocalTask\ContentTabLocalTask'; $this->derivatives[$route_name]['route_name'] = 'content_tab.content_type'; $this->derivatives[$route_name]['parent_id'] = 'content_tab.content_tab'; } } return parent::getDerivativeDefinitions($base_plugin_definition); }
/** * {@inheritdoc} */ public function getDerivativeDefinitions($base_plugin_definition) { $this->derivatives = array(); $types = entity_test_entity_types(ENTITY_TEST_TYPES_ROUTING); foreach ($types as $entity_type) { $this->derivatives[$entity_type . '.canonical'] = array(); $this->derivatives[$entity_type . '.canonical']['base_route'] = "entity.{$entity_type}.canonical"; $this->derivatives[$entity_type . '.canonical']['route_name'] = "entity.{$entity_type}.canonical"; $this->derivatives[$entity_type . '.canonical']['title'] = 'View'; $this->derivatives[$entity_type . '.edit'] = array(); $this->derivatives[$entity_type . '.edit']['base_route'] = "entity.{$entity_type}.canonical"; $this->derivatives[$entity_type . '.edit']['route_name'] = "entity.{$entity_type}.edit_form"; $this->derivatives[$entity_type . '.edit']['title'] = 'Edit'; } return parent::getDerivativeDefinitions($base_plugin_definition); }
/** * {@inheritdoc} */ public function getDerivativeDefinitions($base_plugin_definition) { $this->derivatives = []; $event_types = $this->eventManager->getEventTypes(); foreach (array_keys($event_types) as $entity_type) { // Only need one set of tasks task per entity type. if ($this->routeProvider->getRouteByName("entity.{$entity_type}.canonical")) { $event_default = "rng.event.{$entity_type}.event.default"; $this->derivatives["rng.event.{$entity_type}.event.rules"] = array('title' => t('Rules'), 'route_name' => "rng.event.{$entity_type}.rules", 'parent_id' => 'rng.local_tasks:' . $event_default, 'weight' => 20); } } foreach ($this->derivatives as &$entry) { $entry += $base_plugin_definition; } return parent::getDerivativeDefinitions($base_plugin_definition); }
/** * {@inheritdoc} */ public function getDerivativeDefinitions($base_plugin_definition) { $mappers = $this->mapperManager->getMappers(); foreach ($mappers as $plugin_id => $mapper) { /** @var \Drupal\config_translation\ConfigMapperInterface $mapper */ $route_name = $mapper->getOverviewRouteName(); $base_route = $mapper->getBaseRouteName(); if (!empty($base_route)) { $this->derivatives[$route_name] = $base_plugin_definition; $this->derivatives[$route_name]['config_translation_plugin_id'] = $plugin_id; $this->derivatives[$route_name]['class'] = '\\Drupal\\config_translation\\Plugin\\Menu\\LocalTask\\ConfigTranslationLocalTask'; $this->derivatives[$route_name]['route_name'] = $route_name; $this->derivatives[$route_name]['base_route'] = $base_route; } } return parent::getDerivativeDefinitions($base_plugin_definition); }
/** * {@inheritdoc} */ public function getDerivativeDefinitions($base_plugin_definition) { $language_manager = \Drupal::languageManager(); if ($language_manager instanceof ConfigurableLanguageManagerInterface) { $info = $language_manager->getDefinedLanguageTypesInfo(); $configurable_types = $language_manager->getLanguageTypes(); foreach ($configurable_types as $type) { $this->derivatives[$type] = $base_plugin_definition; $this->derivatives[$type]['admin_label'] = t('Language switcher (@type)', array('@type' => $info[$type]['name'])); } // If there is just one configurable type then change the title of the // block. if (count($configurable_types) == 1) { $this->derivatives[reset($configurable_types)]['admin_label'] = t('Language switcher'); } } return parent::getDerivativeDefinitions($base_plugin_definition); }
/** * {@inheritdoc} */ public function getDerivativeDefinitions($base_plugin_definition) { // We need a contextual link defined for each entity type (that may contain // a Juicebox gallery) in order to provide a link to the relevant edit // display screen. These link definitions must be unique because the related // route to the edit display screen is different for each entity type. foreach ($this->entityTypeManager->getDefinitions() as $entity_type_id => $entity_type) { // Only fieldable entity are candidates. if ($entity_type->isSubclassOf('\\Drupal\\Core\\Entity\\ContentEntityInterface')) { $bundle_entity_type = $entity_type->getBundleEntityType(); $type_name = $bundle_entity_type == 'bundle' ? $entity_type_id : $bundle_entity_type; $this->derivatives['juicebox.conf_field_' . $entity_type_id]['title'] = t('Configure galleries of this field instance'); $this->derivatives['juicebox.conf_field_' . $entity_type_id]['route_name'] = 'entity.entity_view_display.' . $entity_type_id . '.view_mode'; $this->derivatives['juicebox.conf_field_' . $entity_type_id]['group'] = 'juicebox_conf_field_' . $entity_type_id; } } return parent::getDerivativeDefinitions($base_plugin_definition); }
/** * {@inheritdoc} */ public function getDerivativeDefinitions($base_plugin_definition) { // Create contextual links for all mappers. $mappers = $this->mapperManager->getMappers(); foreach ($mappers as $plugin_id => $mapper) { // @todo Contextual groups do not map to entity types in a predictable // way. See https://drupal.org/node/2134841 to make them predictable. $group_name = $mapper->getContextualLinkGroup(); if (empty($group_name)) { continue; } /** @var \Drupal\config_translation\ConfigMapperInterface $mapper */ $route_name = $mapper->getOverviewRouteName(); $this->derivatives[$route_name] = $base_plugin_definition; $this->derivatives[$route_name]['config_translation_plugin_id'] = $plugin_id; $this->derivatives[$route_name]['class'] = '\\Drupal\\config_translation\\Plugin\\Menu\\ContextualLink\\ConfigTranslationContextualLink'; $this->derivatives[$route_name]['route_name'] = $route_name; $this->derivatives[$route_name]['group'] = $group_name; } return parent::getDerivativeDefinitions($base_plugin_definition); }
/** * {@inheritdoc} */ public function getDerivativeDefinitions($base_plugin_definition) { foreach ($this->entityManager->getDefinitions() as $entity_type_id => $entity_type) { $this->derivatives[$entity_type_id] = $base_plugin_definition; $this->derivatives[$entity_type_id]['entity_types'] = array($entity_type_id); $this->derivatives[$entity_type_id]['label'] = t('@entity_type selection', array('@entity_type' => $entity_type->getLabel())); $this->derivatives[$entity_type_id]['base_plugin_label'] = (string) $base_plugin_definition['label']; // If the entity type doesn't provide a 'label' key in its plugin // definition, we have to use the alternate PhpSelection class as default // plugin, which allows filtering the target entities by their label() // method. The major downside of PhpSelection is that it is more expensive // performance-wise than SelectionBase because it has to load all the // target entities in order to perform the filtering process, regardless // of whether a limit has been passed. // @see \Drupal\Core\Entity\Plugin\EntityReferenceSelection\PhpSelection if (!$entity_type->hasKey('label')) { $this->derivatives[$entity_type_id]['class'] = 'Drupal\\Core\\Entity\\Plugin\\EntityReferenceSelection\\PhpSelection'; } } return parent::getDerivativeDefinitions($base_plugin_definition); }