当前位置: 首页>>代码示例>>PHP>>正文


PHP PluginManagerInterface::getDefinitions方法代码示例

本文整理汇总了PHP中Drupal\Component\Plugin\PluginManagerInterface::getDefinitions方法的典型用法代码示例。如果您正苦于以下问题:PHP PluginManagerInterface::getDefinitions方法的具体用法?PHP PluginManagerInterface::getDefinitions怎么用?PHP PluginManagerInterface::getDefinitions使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Drupal\Component\Plugin\PluginManagerInterface的用法示例。


在下文中一共展示了PluginManagerInterface::getDefinitions方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: __construct

 /**
  * Constructs a FullcalendarPluginBag object.
  *
  * @param \Drupal\Component\Plugin\PluginManagerInterface $manager
  *   The manager to be used for instantiating plugins.
  * @param \Drupal\views\Plugin\views\style\StylePluginBase $style
  *   The style plugin that contains these plugins.
  */
 public function __construct(PluginManagerInterface $manager, StylePluginBase $style)
 {
     $this->manager = $manager;
     $this->style = $style;
     // Store all display IDs to access them easy and fast.
     $definitions = $this->manager->getDefinitions();
     $this->instanceIDs = drupal_map_assoc(array_keys($definitions));
 }
开发者ID:anatalsceo,项目名称:en-classe,代码行数:16,代码来源:FullcalendarPluginBag.php

示例2: getPermissions

 /**
  * Returns permissions.
  *
  * @return array[]
  *   The structure is the same as that of *.permissions.yml files.
  */
 public function getPermissions()
 {
     $permissions = [];
     $definitions = $this->paymentMethodConfigurationManager->getDefinitions();
     foreach ($definitions as $plugin_id => $definition) {
         $permissions['payment.payment_method_configuration.create.' . $plugin_id] = array('title' => $this->t('Create %plugin_label payment method configurations', array('%plugin_label' => $definition['label'])));
     }
     return $permissions;
 }
开发者ID:nishantkumar155,项目名称:drupal8.crackle,代码行数:15,代码来源:Permissions.php

示例3: loadConfiguration

 /**
  * Loads the plugin configuration.
  *
  * @return bool[]
  *   Keys are currency_exchanger plugin names. Values are booleans that
  *   describe whether the plugins are enabled. Items are ordered by weight.
  */
 public function loadConfiguration()
 {
     $definitions = $this->currencyExchangeRateProviderManager->getDefinitions();
     $configuration_data = $this->configFactory->get('currency.exchange_rate_provider')->get('plugins');
     $configuration = array();
     foreach ($configuration_data as $data) {
         $configuration[$data['plugin_id']] = $data['status'];
     }
     return $configuration + array_fill_keys(array_keys($definitions), FALSE);
 }
开发者ID:nishantkumar155,项目名称:drupal8.crackle,代码行数:17,代码来源:PluginBasedExchangeRateProvider.php

示例4: invoke

 /**
  * Invokes the implementation.
  */
 public function invoke()
 {
     $bundles = [];
     foreach ($this->paymentTypeManager->getDefinitions() as $plugin_id => $definition) {
         $bundles['payment'][$plugin_id] = array('label' => $definition['label']);
     }
     foreach ($this->paymentMethodConfigurationManager->getDefinitions() as $plugin_id => $definition) {
         $bundles['payment_method_configuration'][$plugin_id] = array('label' => $definition['label']);
     }
     return $bundles;
 }
开发者ID:nishantkumar155,项目名称:drupal8.crackle,代码行数:14,代码来源:EntityBundleInfo.php

示例5: getParentID

 /**
  * Gets the parent task's link ID, if any.
  *
  * @return string|NULL
  */
 public function getParentID()
 {
     $path = $this->getSource()->getParent()->getPath()->__toString();
     if ($this->index->containsKey($path)) {
         return $this->index[$path]->getIdentifier();
     }
     $parent = $this->getDestination()->getParent()->getIdentifier();
     foreach ($this->linkManager->getDefinitions() as $id => $link) {
         if ($link['route_name'] == $parent) {
             return $id;
         }
     }
 }
开发者ID:nishantkumar155,项目名称:drupal8.crackle,代码行数:18,代码来源:LocalTaskLinkBinding.php

示例6: templateList

 /**
  * Create template list table.
  *
  * @return array
  *  Render array of template list.
  */
 public function templateList()
 {
     $table = array('#type' => 'table', '#header' => array($this->t('Name'), $this->t('Description'), $this->t('Add')), '#empty' => $this->t('There are no available Views Templates'));
     /** @var \Drupal\views_templates\Plugin\ViewsBuilderPluginInterface $definition */
     foreach ($this->builder_manager->getDefinitions() as $definition) {
         /** @var \Drupal\views_templates\Plugin\ViewsBuilderPluginInterface $builder */
         $builder = $this->builder_manager->createInstance($definition['id']);
         if ($builder->templateExists()) {
             $plugin_id = $builder->getPluginId();
             $row = ['name' => ['#plain_text' => $builder->getAdminLabel()], 'description' => ['#plain_text' => $builder->getDescription()], 'add' => ['#type' => 'link', '#title' => t('Add'), '#url' => Url::fromRoute('views_templates.create_from_template', ['view_template' => $plugin_id])]];
             $table[$plugin_id] = $row;
         }
     }
     return $table;
 }
开发者ID:CIGIHub,项目名称:bsia-drupal8,代码行数:21,代码来源:ViewsBuilderController.php

示例7: destroyIndex

 /**
  * Destroys all index data for this target.
  */
 public function destroyIndex()
 {
     $indexers = array_keys($this->indexerManager->getDefinitions());
     foreach ($indexers as $id) {
         $this->getIndexer($id)->destroy();
     }
 }
开发者ID:nishantkumar155,项目名称:drupal8.crackle,代码行数:10,代码来源:Target.php

示例8: buildForm

 /**
  * {@inheritdoc}
  */
 public function buildForm(array $form, FormStateInterface $form_state)
 {
     // The table containing all the field types discovered in the system.
     $form['fields'] = array('#type' => 'table', '#tree' => TRUE, '#header' => $this->getTableHeader(), '#empty' => $this->t('No field types found.'), '#prefix' => '<div id="field-display-overview-wrapper">', '#suffix' => '</div>', '#attributes' => array('class' => array('field-ui-overview'), 'id' => 'field-display-overview'));
     // Get the definition of all @FieldDiffBuilder plugins.
     $diff_plugin_definitions = $this->diffBuilderManager->getDefinitions();
     $plugins = array();
     foreach ($diff_plugin_definitions as $plugin_definition) {
         if (isset($plugin_definition['field_types'])) {
             // Iterate through all the field types this plugin supports
             // and for every such field type add the id of the plugin.
             foreach ($plugin_definition['field_types'] as $id) {
                 $plugins[$id][] = $plugin_definition['id'];
             }
         }
     }
     // Get all the field type plugins.
     $field_definitions = $this->fieldTypePluginManager->getDefinitions();
     foreach ($field_definitions as $field_type => $field_definition) {
         // Build a row in the table for every field type.
         $form['fields'][$field_type] = $this->buildFieldRow($field_type, $field_definition, $plugins, $diff_plugin_definitions, $form_state);
     }
     // Submit button for the form.
     $form['actions'] = array('#type' => 'actions');
     $form['actions']['submit'] = array('#type' => 'submit', '#button_type' => 'primary', '#value' => $this->t('Save'));
     $form['#attached']['library'][] = 'field_ui/drupal.field_ui';
     $form['#attached']['library'][] = 'diff/diff.general';
     return $form;
 }
开发者ID:AllieRays,项目名称:debugging-drupal-8,代码行数:32,代码来源:FieldTypesSettingsForm.php

示例9: selectDisplayVariant

 /**
  * Presents a list of display variants to add to the page entity.
  *
  * @param \Drupal\page_manager\PageInterface $page
  *   The page entity.
  *
  * @return array
  *   The display variant selection page.
  */
 public function selectDisplayVariant(PageInterface $page)
 {
     $build = ['#theme' => 'links', '#links' => []];
     foreach ($this->variantManager->getDefinitions() as $display_variant_id => $display_variant) {
         $build['#links'][$display_variant_id] = ['title' => $display_variant['admin_label'], 'url' => Url::fromRoute('page_manager.display_variant_add', ['page' => $page->id(), 'display_variant_id' => $display_variant_id]), 'attributes' => ['class' => ['use-ajax'], 'data-dialog-type' => 'modal', 'data-dialog-options' => Json::encode(['width' => 'auto'])]];
     }
     return $build;
 }
开发者ID:pulibrary,项目名称:recap,代码行数:17,代码来源:PageManagerController.php

示例10: selectVariant

 /**
  * Presents a list of variants to add to the page entity.
  *
  * @param \Drupal\page_manager\PageInterface $page
  *   The page entity.
  *
  * @return array
  *   The variant selection page.
  */
 public function selectVariant(PageInterface $page)
 {
     $build = ['#theme' => 'links', '#links' => []];
     foreach ($this->variantManager->getDefinitions() as $variant_plugin_id => $variant_plugin) {
         $build['#links'][$variant_plugin_id] = ['title' => $variant_plugin['admin_label'], 'url' => Url::fromRoute('entity.page_variant.add_form', ['page' => $page->id(), 'variant_plugin_id' => $variant_plugin_id]), 'attributes' => $this->getAjaxAttributes()];
     }
     return $build;
 }
开发者ID:AllieRays,项目名称:debugging-drupal-8,代码行数:17,代码来源:PageManagerController.php

示例11: getNegotiationMethods

 /**
  * {@inheritdoc}
  */
 public function getNegotiationMethods($type = NULL)
 {
     $definitions = $this->negotiatorManager->getDefinitions();
     if (isset($type)) {
         $enabled_methods = $this->getEnabledNegotiators($type);
         $definitions = array_intersect_key($definitions, $enabled_methods);
     }
     return $definitions;
 }
开发者ID:Nikola-xiii,项目名称:d8intranet,代码行数:12,代码来源:LanguageNegotiator.php

示例12: __construct

 /**
  * Constructs an EntityComparisonBase object.
  *
  * @param DiffFormatter $diff_formatter
  *   Diff formatter service.
  * @param DateFormatter $date
  *   DateFormatter service.
  * @param PluginManagerInterface $plugin_manager
  *   The Plugin manager service.
  * @param DiffEntityParser $entityParser
  *   The diff field builder plugin manager.
  */
 public function __construct(DiffFormatter $diff_formatter, DateFormatter $date, PluginManagerInterface $plugin_manager, DiffEntityParser $entityParser)
 {
     $this->diffFormatter = $diff_formatter;
     $this->date = $date;
     $this->fieldTypeDefinitions = $plugin_manager->getDefinitions();
     $this->config = $this->config('diff.settings');
     $this->pluginsConfig = $this->config('diff.plugins');
     $this->nonBreakingSpace = new FormattableMarkup('&nbsp;', array());
     $this->entityParser = $entityParser;
 }
开发者ID:Progressable,项目名称:openway8,代码行数:22,代码来源:EntityComparisonBase.php

示例13: getEditor

 /**
  * {@inheritdoc}
  */
 public function getEditor($formatter_type, FieldItemListInterface $items)
 {
     // Build a static cache of the editors that have registered themselves as
     // alternatives to a certain editor.
     if (!isset($this->alternatives)) {
         $editors = $this->editorManager->getDefinitions();
         foreach ($editors as $alternative_editor_id => $editor) {
             if (isset($editor['alternativeTo'])) {
                 foreach ($editor['alternativeTo'] as $original_editor_id) {
                     $this->alternatives[$original_editor_id][] = $alternative_editor_id;
                 }
             }
         }
     }
     // Check if the formatter defines an appropriate in-place editor. For
     // example, text formatters displaying untrimmed text can choose to use the
     // 'plain_text' editor. If the formatter doesn't specify, fall back to the
     // 'form' editor, since that can work for any field. Formatter definitions
     // can use 'disabled' to explicitly opt out of in-place editing.
     $formatter_info = $this->formatterManager->getDefinition($formatter_type);
     $editor_id = $formatter_info['quickedit']['editor'];
     if ($editor_id === 'disabled') {
         return;
     } elseif ($editor_id === 'form') {
         return 'form';
     }
     // No early return, so create a list of all choices.
     $editor_choices = array($editor_id);
     if (isset($this->alternatives[$editor_id])) {
         $editor_choices = array_merge($editor_choices, $this->alternatives[$editor_id]);
     }
     // Make a choice.
     foreach ($editor_choices as $editor_id) {
         $editor = $this->editorManager->createInstance($editor_id);
         if ($editor->isCompatible($items)) {
             return $editor_id;
         }
     }
     // We still don't have a choice, so fall back to the default 'form' editor.
     return 'form';
 }
开发者ID:neetumorwani,项目名称:blogging,代码行数:44,代码来源:EditorSelector.php

示例14: form

 /**
  * {@inheritdoc}
  */
 public function form(array $form, FormStateInterface $form_state)
 {
     $form = parent::form($form, $form_state);
     /** @var $service_endpoint \Drupal\services\Entity\ServiceEndpoint */
     $service_endpoint = $this->entity;
     $form['label'] = array('#type' => 'textfield', '#title' => $this->t('Label'), '#maxlength' => 255, '#default_value' => $service_endpoint->label(), '#description' => $this->t("Label for the service endpoint."), '#required' => TRUE);
     $form['id'] = array('#type' => 'machine_name', '#default_value' => $service_endpoint->id(), '#machine_name' => array('exists' => '\\Drupal\\services\\Entity\\ServiceEndpoint::load'), '#disabled' => !$service_endpoint->isNew());
     $form['endpoint'] = array('#type' => 'textfield', '#title' => $this->t('Endpoint'), '#maxlength' => 255, '#default_value' => $service_endpoint->getEndpoint(), '#description' => $this->t("URL endpoint."), '#required' => TRUE);
     $opts = [];
     foreach ($this->manager->getDefinitions() as $plugin_id => $definition) {
         $opts[$plugin_id] = ['title' => (string) $definition['title'], 'endpoint' => $definition['path'], 'category' => $definition['category']];
         if (isset($definition['warning'])) {
             $opts[$plugin_id]['description'] = $definition['warning'] . ' ' . $definition['description'];
             $opts[$plugin_id]['#attributes'] = array('class' => array('services-experimental'));
         } else {
             $opts[$plugin_id]['description'] = $definition['description'];
         }
     }
     $form['service_providers'] = array('#type' => 'tableselect', '#header' => ['title' => $this->t('Definition'), 'endpoint' => $this->t('Endpoint'), 'category' => $this->t('Category'), 'description' => $this->t('Description')], '#title' => $this->t('Service Provider'), '#empty' => t('No service definitions exist'), '#required' => TRUE, '#options' => $opts, '#default_value' => $service_endpoint->getServiceProviders(), '#attached' => array('library' => array('services/services.admin')));
     return $form;
 }
开发者ID:Jbartsch,项目名称:travelbruh-api,代码行数:24,代码来源:ServiceEndpointForm.php

示例15: getContainerDefinition

 /**
  * {@inheritdoc}
  */
 public function getContainerDefinition()
 {
     $definitions = $this->serviceProviderManager->getDefinitions();
     $container_definition = array();
     $service_providers = array();
     // Populate service providers.
     foreach ($definitions as $plugin_id => $definition) {
         $service_providers[$plugin_id] = $this->serviceProviderManager->createInstance($plugin_id);
     }
     // Get container definition of each service provider and merge them.
     foreach ($definitions as $plugin_id => $definition) {
         $service_provider = $service_providers[$plugin_id];
         $container_definition = NestedArray::mergeDeep($container_definition, $service_provider->getContainerDefinition());
     }
     $container_definition += array('services' => array(), 'parameters' => array());
     // @codeCoverageIgnore
     // Find and setup tags for container altering.
     $container_definition['tags'] = array();
     // Setup the tags structure.
     foreach ($container_definition['services'] as $service => $definition) {
         if (isset($definition['tags'])) {
             foreach ($definition['tags'] as $tag) {
                 $tag_name = $tag['name'];
                 unset($tag['name']);
                 $container_definition['tags'][$tag_name][$service][] = $tag;
             }
         }
     }
     // Ensure container definition can be altered.
     foreach ($definitions as $plugin_id => $definition) {
         $service_provider = $service_providers[$plugin_id];
         $service_provider->alterContainerDefinition($container_definition);
     }
     // Last give a chance for traditional modules to alter this.
     $this->moduleAlter($container_definition);
     // Remove the tags again, not needed for the final build of the container.
     unset($container_definition['tags']);
     return $container_definition;
 }
开发者ID:akapivo,项目名称:www.dmi.be,代码行数:42,代码来源:ContainerBuilder.php


注:本文中的Drupal\Component\Plugin\PluginManagerInterface::getDefinitions方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。