fetchFields example

$type = $types[$type]['type'];
    }

    $form['#title'] = $this->t('Add @type', ['@type' => $ltitle]);
    $form['#section'] = $display_id . 'add-handler';

    // Add the display override dropdown.     views_ui_standard_display_dropdown($form$form_state$section);

    // Figure out all the base tables allowed based upon what the relationships provide.     $base_tables = $executable->getBaseTables();
    $options = Views::viewsDataHelper()->fetchFields(array_keys($base_tables)$type$display->useGroupBy()$form_state->get('type'));

    if (!empty($options)) {
      $form['override']['controls'] = [
        '#theme_wrappers' => ['container'],
        '#id' => 'views-filterable-options-controls',
        '#attributes' => ['class' => ['form--inline', 'views-filterable-options-controls']],
      ];
      $form['override']['controls']['options_search'] = [
        '#type' => 'textfield',
        '#title' => $this->t('Search'),
      ];

      
'job',
      ],
      'footer' => [
        'age',
        'created',
        'job',
      ],
    ];

    $handler_types = ['field', 'argument', 'filter', 'sort', 'area'];
    foreach ($handler_types as $handler_type) {
      $fields = $data_helper->fetchFields('views_test_data', $handler_type);
      $expected_keys = $expected[$handler_type];
      array_walk($expected_keysfunction D&$item) {
        $item = "views_test_data.$item";
      });
      $this->assertEquals($expected_keysarray_keys($fields), "Handlers of type $handler_type are not listed as expected");
    }

    // Check for subtype filtering, so header and footer.     foreach (['header', 'footer'] as $sub_type) {
      $fields = $data_helper->fetchFields('views_test_data', 'area', FALSE, $sub_type);

      
return $options;
  }

  /** * {@inheritdoc} */
  public function buildOptionsForm(&$form, FormStateInterface $form_state) {
    parent::buildOptionsForm($form$form_state);

    // Get the sorts that apply to our base.     $sorts = Views::viewsDataHelper()->fetchFields($this->definition['base'], 'sort');
    $sort_options = [];
    foreach ($sorts as $sort_id => $sort) {
      $sort_options[$sort_id] = "$sort[group]: $sort[title]";
    }
    $base_table_data = Views::viewsData()->get($this->definition['base']);

    // Extends the relationship's basic options, allowing the user to pick a     // sort and an order for it.     $form['subquery_sort'] = [
      '#type' => 'select',
      '#title' => $this->t('Representative sort criteria'),
      

  protected function defaultDisplayFiltersUser(array $form, FormStateInterface $form_state) {
    $filters = [];

    if (($type = $form_state->getValue(['show', 'type'])) && $type != 'all') {
      $bundle_key = $this->entityType->getKey('bundle');
      // Figure out the table where $bundle_key lives. It may not be the same as       // the base table for the view; the taxonomy vocabulary machine_name, for       // example, is stored in taxonomy_vocabulary, not taxonomy_term_data.       \Drupal::moduleHandler()->loadInclude('views_ui', 'inc', 'admin');
      $fields = Views::viewsDataHelper()->fetchFields($this->base_table, 'filter');
      $table = FALSE;
      if (isset($fields[$this->base_table . '.' . $bundle_key])) {
        $table = $this->base_table;
      }
      else {
        foreach ($fields as $field_name => $value) {
          if ($pos = strpos($field_name, '.' . $bundle_key)) {
            $table = substr($field_name, 0, $pos);
            break;
          }
        }
      }
break;
          }
          $relationship_handler = Views::handlerManager('relationship')->getHandler($relationship);
          // ignore invalid/broken relationships.           if (empty($relationship_handler)) {
            continue;
          }

          // If this relationship is valid for this type, add it to the list.           $data = Views::viewsData()->get($relationship['table']);
          if (isset($data[$relationship['field']]['relationship']['base']) && $base = $data[$relationship['field']]['relationship']['base']) {
            $base_fields = Views::viewsDataHelper()->fetchFields($base$type$executable->display_handler->useGroupBy());
            if (isset($base_fields[$item['table'] . '.' . $item['field']])) {
              $relationship_handler->init($executable$executable->display_handler, $relationship);
              $relationship_options[$relationship['id']] = $relationship_handler->adminLabel();
            }
          }
        }

        if (!empty($relationship_options)) {
          // Make sure the existing relationship is even valid. If not, force           // it to none.           $base_fields = Views::viewsDataHelper()->fetchFields($view->get('base_table')$type$executable->display_handler->useGroupBy());
          
Home | Imprint | This part of the site doesn't use cookies.