當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。