Commit 28088f38 authored by alexpott's avatar alexpott

Issue #2550287 by cilefen, hexabinaer, legolasbo, dawehner: Expand display...

Issue #2550287 by cilefen, hexabinaer, legolasbo, dawehner: Expand display "Comment" trim from 10 to 80 characters
parent 70880e91
...@@ -9,7 +9,6 @@ ...@@ -9,7 +9,6 @@
use Drupal\Component\Plugin\DependentPluginInterface; use Drupal\Component\Plugin\DependentPluginInterface;
use Drupal\Component\Utility\Html; use Drupal\Component\Utility\Html;
use Drupal\Component\Utility\Unicode;
use Drupal\Component\Utility\SafeMarkup; use Drupal\Component\Utility\SafeMarkup;
use Drupal\Core\Cache\Cache; use Drupal\Core\Cache\Cache;
use Drupal\Core\Cache\CacheableMetadata; use Drupal\Core\Cache\CacheableMetadata;
...@@ -1130,7 +1129,7 @@ public function optionsSummary(&$categories, &$options) { ...@@ -1130,7 +1129,7 @@ public function optionsSummary(&$categories, &$options) {
); );
} }
$display_comment = Unicode::substr($this->getOption('display_comment'), 0, 10); $display_comment = views_ui_truncate($this->getOption('display_comment'), 80);
$options['display_comment'] = array( $options['display_comment'] = array(
'category' => 'other', 'category' => 'other',
'title' => $this->t('Administrative comment'), 'title' => $this->t('Administrative comment'),
......
...@@ -45,13 +45,18 @@ public function testDeleteLink() { ...@@ -45,13 +45,18 @@ public function testDeleteLink() {
} }
/** /**
* Tests the machine name form. * Tests the machine name and administrative comment forms.
*/ */
public function testMachineNameOption() { public function testOtherOptions() {
$this->drupalGet('admin/structure/views/view/test_view'); $this->drupalGet('admin/structure/views/view/test_view');
// Add a new attachment display. // Add a new attachment display.
$this->drupalPostForm(NULL, array(), 'Add Attachment'); $this->drupalPostForm(NULL, array(), 'Add Attachment');
// Test that a long administrative comment is truncated.
$edit = array('display_comment' => 'one two three four five six seven eight nine ten eleven twelve thirteen fourteen fifteen');
$this->drupalPostForm('admin/structure/views/nojs/display/test_view/attachment_1/display_comment', $edit, 'Apply');
$this->assertText('one two three four five six seven eight nine ten eleven twelve thirteen fourteen...');
// Change the machine name for the display from page_1 to test_1. // Change the machine name for the display from page_1 to test_1.
$edit = array('display_id' => 'test_1'); $edit = array('display_id' => 'test_1');
$this->drupalPostForm('admin/structure/views/nojs/display/test_view/attachment_1/display_id', $edit, 'Apply'); $this->drupalPostForm('admin/structure/views/nojs/display/test_view/attachment_1/display_id', $edit, 'Apply');
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment