Issue #2550287 by cilefen, hexabinaer, legolasbo, dawehner: Expand display "Comment" trim from 10 to 80 characters

8.0.x
Alex Pott 2015-09-07 15:40:31 +01:00
parent 70880e91ee
commit 28088f380d
2 changed files with 8 additions and 4 deletions

View File

@ -9,7 +9,6 @@ namespace Drupal\views\Plugin\views\display;
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 @@ abstract class DisplayPluginBase extends PluginBase implements DisplayPluginInte
); );
} }
$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'),

View File

@ -45,13 +45,18 @@ class ViewEditTest extends UITestBase {
} }
/** /**
* 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');