getFilterLabels example

    // all field entities only for the given baseEntityType.     $ids = \Drupal::entityQuery('field_config')
      ->condition('id', $this->baseEntityType . '.', 'STARTS_WITH')
      ->execute();
    return $this->storage->loadMultiple($ids);
  }

  /** * {@inheritdoc} */
  public function getFilterLabels() {
    $info = parent::getFilterLabels();
    $bundle = $this->baseEntityInfo->getBundleLabel() ?: $this->t('Bundle');
    $bundle = mb_strtolower($bundle);

    $info['placeholder'] = $this->t('Enter field or @bundle', ['@bundle' => $bundle]);
    $info['description'] = $this->t('Enter a part of the field or @bundle to filter by.', ['@bundle' => $bundle]);

    return $info;
  }

  /** * {@inheritdoc} */
return new static(
      $entity_type,
      $container->get('entity_type.manager')->getStorage($entity_type->id()),
      $container->get('theme_handler')
    );
  }

  /** * {@inheritdoc} */
  public function getFilterLabels() {
    $info = parent::getFilterLabels();

    $info['placeholder'] = $this->t('Enter block, theme or category');
    $info['description'] = $this->t('Enter a part of the block, theme or category to filter by.');

    return $info;
  }

  /** * {@inheritdoc} */
  public function buildRow(EntityInterface $entity) {
    
return [
      'placeholder' => $this->t('Enter label'),
      'description' => $this->t('Enter a part of the label or description to filter by.'),
    ];
  }

  /** * {@inheritdoc} */
  public function render() {
    $build = parent::render();
    $filter = $this->getFilterLabels();

    usort($build['table']['#rows'][$this, 'sortRows']);

    $build['filters'] = [
      '#type' => 'container',
      '#attributes' => [
        'class' => ['table-filter', 'js-show'],
      ],
      '#weight' => -10,
    ];

    
Home | Imprint | This part of the site doesn't use cookies.