You are here

trait AdminLabelTrait in Views XML Backend 8

Helps views plugins display a useful admin label.

Hierarchy

8 files declare their use of AdminLabelTrait
Date.php in src/Plugin/views/filter/Date.php
Contains \Drupal\views_xml_backend\Plugin\views\filter\Date.
Date.php in src/Plugin/views/argument/Date.php
Contains \Drupal\views_xml_backend\Plugin\views\argument\Date.
Date.php in src/Plugin/views/field/Date.php
Contains \Drupal\views_xml_backend\Plugin\views\field\Date.
Numeric.php in src/Plugin/views/filter/Numeric.php
Contains \Drupal\views_xml_backend\Plugin\views\filter\Numeric.
Standard.php in src/Plugin/views/filter/Standard.php
Contains \Drupal\views_xml_backend\Plugin\views\filter\Standard.

... See full list

File

src/AdminLabelTrait.php, line 13
Contains \Drupal\views_xml_backendAdminLabelTrait.

Namespace

Drupal\views_xml_backend
View source
trait AdminLabelTrait {

  /**
   * Returns a string representing this handler's name in the UI.
   *
   * @param bool $short
   *   Whether to return a short label.
   *
   * @return string
   *   The admin label.
   *
   * @see \Drupal\views\Plugin\views\ViewsHandlerInterface::adminLabel()
   */
  public function adminLabel($short = FALSE) {
    if (!empty($this->options['admin_label'])) {
      return $this->options['admin_label'];
    }
    $title = $short && isset($this->definition['title short']) ? $this->definition['title short'] : $this->definition['title'];
    return $this
      ->t('@xpath: @title', [
      '@xpath' => $this->options['xpath_selector'],
      '@title' => $title,
    ]);
  }

}

Members

Namesort descending Modifiers Type Description Overrides
AdminLabelTrait::adminLabel public function Returns a string representing this handler's name in the UI.