fetchPluginNames example


        // Always allow a display to be deleted.         $build['top']['actions']['delete'] = [
          '#type' => 'submit',
          '#value' => $this->t('Delete @display_title', ['@display_title' => $display_title]),
          '#limit_validation_errors' => [],
          '#submit' => ['::submitDisplayDelete', '::submitDelayDestination'],
          '#prefix' => '<li class="delete">',
          "#suffix" => '</li>',
        ];

        foreach (Views::fetchPluginNames('display', NULL, [$view->get('storage')->get('base_table')]) as $type => $label) {
          if ($type == $display['display_plugin']) {
            continue;
          }

          $build['top']['actions']['duplicate_as'][$type] = [
            '#type' => 'submit',
            '#value' => $this->t('Duplicate as @type', ['@type' => $label]),
            '#limit_validation_errors' => [],
            '#submit' => ['::submitDuplicateDisplayAsType', '::submitDelayDestination'],
            '#prefix' => '<li class="duplicate">',
            '#suffix' => '</li>',
          ];
'#open' => TRUE,
    ];

    $form['debug']['sql_signature'] = [
      '#type' => 'checkbox',
      '#title' => $this->t('Add Views signature to all SQL queries'),
      '#description' => $this->t("All Views-generated queries will include the name of the views and display 'view-name:display-name' as a string at the end of the SELECT clause. This makes identifying Views queries in database server logs simpler, but should only be used when troubleshooting."),

      '#default_value' => $config->get('sql_signature'),
    ];

    $options = Views::fetchPluginNames('display_extender');
    if (!empty($options)) {
      $form['extenders'] = [
        '#type' => 'details',
        '#title' => $this->t('Display extenders'),
        '#open' => TRUE,
      ];
      $form['extenders']['display_extenders'] = [
        '#default_value' => array_filter($config->get('display_extenders')),
        '#options' => $options,
        '#type' => 'checkboxes',
        '#description' => $this->t('Select extensions of the views interface.'),
      ];
$form['access'] = [
          '#prefix' => '<div class="clearfix">',
          '#suffix' => '</div>',
          '#tree' => TRUE,
        ];

        $access = $this->getOption('access');
        $form['access']['type'] = [
          '#title' => $this->t('Access'),
          '#title_display' => 'invisible',
          '#type' => 'radios',
          '#options' => Views::fetchPluginNames('access', $this->getType()[$this->view->storage->get('base_table')]),
          '#default_value' => $access['type'],
        ];

        $access_plugin = $this->getPlugin('access');
        if ($access_plugin->usesOptions()) {
          $form['markup'] = [
            '#prefix' => '<div class="js-form-item form-item description">',
            '#markup' => $this->t('You may also adjust the @settings for the currently selected access restriction.', ['@settings' => $this->optionLink($this->t('settings'), 'access_options')]),
            '#suffix' => '</div>',
          ];
        }

        
views_disable_view($view);
    $this->assertFalse($view->status(), 'A view has been disabled.');
    $this->assertEquals(views_view_is_disabled($view), !$view->status(), 'views_view_is_disabled is correct.');
  }

  /** * Tests the \Drupal\views\Views::fetchPluginNames() method. */
  public function testViewsFetchPluginNames() {
    // All style plugins should be returned, as we have not specified a type.     $plugins = Views::fetchPluginNames('style');
    $definitions = $this->container->get('plugin.manager.views.style')->getDefinitions();
    $expected = [];
    foreach ($definitions as $id => $definition) {
      $expected[$id] = $definition['title'];
    }
    asort($expected);
    $this->assertSame(array_keys($expected)array_keys($plugins));

    // Test using the 'test' style plugin type only returns the test_style and     // mapping_test plugins.     $plugins = Views::fetchPluginNames('style', 'test');
    

  public function getSorts() {
    return $this->sorts;
  }

  /** * {@inheritdoc} */
  public function buildForm(array $form, FormStateInterface $form_state) {
    $style_options = Views::fetchPluginNames('style', 'normal', [$this->base_table]);
    $feed_row_options = Views::fetchPluginNames('row', 'feed', [$this->base_table]);
    $path_prefix = Url::fromRoute('<none>', []['absolute' => TRUE])->toString();

    // Add filters and sorts which apply to the view as a whole.     $this->buildFilters($form$form_state);
    $this->buildSorts($form$form_state);

    $form['displays']['page'] = [
      '#type' => 'fieldset',
      '#title' => $this->t('Page settings'),
      '#attributes' => ['class' => ['views-attachment', 'fieldset-no-legend']],
      
/** * {@inheritdoc} */
  public function newDisplay() {
    parent::newDisplay();

    // Set the default row style. Ideally this would be part of the option     // definition, but in this case it's dependent on the view's base table,     // which we don't know until init().     if (empty($this->options['row']['type']) || $this->options['row']['type'] === 'rss_fields') {
      $row_plugins = Views::fetchPluginNames('row', $this->getType()[$this->view->storage->get('base_table')]);
      $default_row_plugin = key($row_plugins);

      $options = $this->getOption('row');
      $options['type'] = $default_row_plugin;
      $this->setOption('row', $options);
    }
  }

  /** * {@inheritdoc} */
  
Home | Imprint | This part of the site doesn't use cookies.