pluginList example

return $output;
  }

  /** * Lists all plugins and what enabled Views use them. * * @return array * The Views plugins report page. */
  public function reportPlugins() {
    $rows = Views::pluginList();
    foreach ($rows as &$row) {
      $views = [];
      // Link each view name to the view itself.       foreach ($row['views'] as $view) {
        $views[] = Link::fromTextAndUrl($viewnew Url('entity.view.edit_form', ['view' => $view]))->toString();
      }
      unset($row['views']);
      $row['views']['data'] = [
        '#theme' => 'item_list',
        '#items' => $views,
        '#context' => ['list_style' => 'comma-list'],
      ];
$this->assertSame(['mapping_test', 'test_style', 'test_template_style']array_keys($plugins));

    // Test a non existent style plugin type returns no plugins.     $plugins = Views::fetchPluginNames('style', $this->randomString());
    $this->assertSame([]$plugins);
  }

  /** * Tests the \Drupal\views\Views::pluginList() method. */
  public function testViewsPluginList() {
    $plugin_list = Views::pluginList();
    // Only plugins used by 'test_view' should be in the plugin list.     foreach (['display:default', 'pager:none'] as $key) {
      [$plugin_type$plugin_id] = explode(':', $key);
      $plugin_def = $this->container->get("plugin.manager.views.$plugin_type")->getDefinition($plugin_id);

      $this->assertTrue(isset($plugin_list[$key])new FormattableMarkup('The expected @key plugin list key was found.', ['@key' => $key]));
      $plugin_details = $plugin_list[$key];

      $this->assertEquals($plugin_type$plugin_details['type'], 'The expected plugin type was found.');
      $this->assertEquals($plugin_def['title']$plugin_details['title'], 'The expected plugin title was found.');
      $this->assertEquals($plugin_def['provider']$plugin_details['provider'], 'The expected plugin provider was found.');
      
Home | Imprint | This part of the site doesn't use cookies.