function ViewFormBase::getDisplayLabel

Same name and namespace in other branches
  1. 9 core/modules/views_ui/src/ViewFormBase.php \Drupal\views_ui\ViewFormBase::getDisplayLabel()
  2. 8.9.x core/modules/views_ui/src/ViewFormBase.php \Drupal\views_ui\ViewFormBase::getDisplayLabel()
  3. 10 core/modules/views_ui/src/ViewFormBase.php \Drupal\views_ui\ViewFormBase::getDisplayLabel()

Placeholder function for overriding $display['display_title'].

@todo Remove this function once editing the display title is possible.

2 calls to ViewFormBase::getDisplayLabel()
ViewEditForm::getDisplayDetails in core/modules/views_ui/src/ViewEditForm.php
Helper function to get the display details section of the edit UI.
ViewFormBase::getDisplayTabs in core/modules/views_ui/src/ViewFormBase.php
Adds tabs for navigating across Displays when editing a View.

File

core/modules/views_ui/src/ViewFormBase.php, line 161

Class

ViewFormBase
Base form for Views forms.

Namespace

Drupal\views_ui

Code

public function getDisplayLabel(ViewUI $view, $display_id, $check_changed = TRUE) {
    $display = $view->get('display');
    $title = $display_id == 'default' ? $this->t('Default') : $display[$display_id]['display_title'];
    $title = Unicode::truncate($title, 25, FALSE, TRUE);
    if ($check_changed && !empty($view->changed_display[$display_id])) {
        $changed = '*';
        $title = $title . $changed;
    }
    return $title;
}

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.