Issue #2916898 by dagmar, jhodgdon, chmez, dpagini, nicolas.rafaelli, alexpott, tstoeckler: Do not use basic_html text format for 'No log messages available.' message
parent
2597462d8d
commit
749b7d7d11
|
|
@ -652,18 +652,16 @@ display:
|
||||||
footer: { }
|
footer: { }
|
||||||
empty:
|
empty:
|
||||||
area:
|
area:
|
||||||
id: area
|
id: area_text_custom
|
||||||
table: views
|
table: views
|
||||||
field: area
|
field: area_text_custom
|
||||||
relationship: none
|
relationship: none
|
||||||
group_type: group
|
group_type: group
|
||||||
admin_label: ''
|
admin_label: 'No log messages available.'
|
||||||
empty: true
|
empty: true
|
||||||
tokenize: false
|
tokenize: false
|
||||||
content:
|
content: 'No log messages available.'
|
||||||
value: 'No log messages available.'
|
plugin_id: text_custom
|
||||||
format: basic_html
|
|
||||||
plugin_id: text
|
|
||||||
relationships:
|
relationships:
|
||||||
uid:
|
uid:
|
||||||
id: uid
|
id: uid
|
||||||
|
|
|
||||||
|
|
@ -156,3 +156,42 @@ function dblog_update_8400() {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Change 'No logs message available.' area plugin type.
|
||||||
|
*/
|
||||||
|
function dblog_update_8600() {
|
||||||
|
$config_factory = \Drupal::configFactory();
|
||||||
|
|
||||||
|
$view = \Drupal::configFactory()->getEditable('views.view.watchdog');
|
||||||
|
if (empty($view)) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
$empty_text = $view->get('display.default.display_options.empty');
|
||||||
|
if (!isset($empty_text['area']['content']['value'])) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Only update the empty text if is untouched from the original version.
|
||||||
|
if ($empty_text['area']['id'] == 'area' &&
|
||||||
|
$empty_text['area']['plugin_id'] == 'text' &&
|
||||||
|
$empty_text['area']['field'] == 'area' &&
|
||||||
|
$empty_text['area']['content']['value'] == 'No log messages available.') {
|
||||||
|
|
||||||
|
$new_config = [
|
||||||
|
'id' => 'area_text_custom',
|
||||||
|
'table' => 'views',
|
||||||
|
'field' => 'area_text_custom',
|
||||||
|
'relationship' => 'none',
|
||||||
|
'group_type' => 'group',
|
||||||
|
'admin_label' => 'No log messages available.',
|
||||||
|
'empty' => TRUE,
|
||||||
|
'tokenize' => FALSE,
|
||||||
|
'content' => 'No log messages available.',
|
||||||
|
'plugin_id' => 'text_custom',
|
||||||
|
];
|
||||||
|
$view->set('display.default.display_options.empty.area', $new_config);
|
||||||
|
$view->save();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
|
||||||
|
|
@ -2,7 +2,7 @@
|
||||||
|
|
||||||
namespace Drupal\Tests\dblog\Functional;
|
namespace Drupal\Tests\dblog\Functional;
|
||||||
|
|
||||||
use Drupal\filter\Entity\FilterFormat;
|
use Drupal\views\Views;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Generate events and verify dblog entries; verify user access to log reports
|
* Generate events and verify dblog entries; verify user access to log reports
|
||||||
|
|
@ -44,27 +44,16 @@ class DbLogViewsTest extends DbLogTest {
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* {@inheritdoc}
|
* Tests the empty text for the watchdog view is not using an input format.
|
||||||
*/
|
*/
|
||||||
public function testDBLogAddAndClear() {
|
public function testEmptyText() {
|
||||||
// Is necesary to create the basic_html format because if absent after
|
$view = Views::getView('watchdog');
|
||||||
// delete the logs, a new log entry is created indicating that basic_html
|
$data = $view->storage->toArray();
|
||||||
// format do not exists.
|
$area = $data['display']['default']['display_options']['empty']['area'];
|
||||||
$basic_html_format = FilterFormat::create([
|
|
||||||
'format' => 'basic_html',
|
|
||||||
'name' => 'Basic HTML',
|
|
||||||
'filters' => [
|
|
||||||
'filter_html' => [
|
|
||||||
'status' => 1,
|
|
||||||
'settings' => [
|
|
||||||
'allowed_html' => '<p> <br> <strong> <a> <em>',
|
|
||||||
],
|
|
||||||
],
|
|
||||||
],
|
|
||||||
]);
|
|
||||||
$basic_html_format->save();
|
|
||||||
|
|
||||||
parent::testDBLogAddAndClear();
|
$this->assertEqual('text_custom', $area['plugin_id']);
|
||||||
|
$this->assertEqual('area_text_custom', $area['field']);
|
||||||
|
$this->assertEqual('No log messages available.', $area['content']);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,42 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
namespace Drupal\Tests\dblog\Functional\Update;
|
||||||
|
|
||||||
|
use Drupal\FunctionalTests\Update\UpdatePathTestBase;
|
||||||
|
use Drupal\views\Views;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Test the upgrade path of changing the emtpy text area for watchdog view.
|
||||||
|
*
|
||||||
|
* @see dblog_update_8600()
|
||||||
|
*
|
||||||
|
* @group Update
|
||||||
|
*/
|
||||||
|
class DblogNoLogsAvailableUpgradeTest extends UpdatePathTestBase {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* {@inheritdoc}
|
||||||
|
*/
|
||||||
|
protected function setDatabaseDumpFiles() {
|
||||||
|
$this->databaseDumpFiles = [
|
||||||
|
__DIR__ . '/../../../../../system/tests/fixtures/update/drupal-8.4.0.bare.standard.php.gz',
|
||||||
|
];
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Tests that no logs available text is now using a custom area.
|
||||||
|
*/
|
||||||
|
public function testDblogUpgradePath() {
|
||||||
|
|
||||||
|
$this->runUpdates();
|
||||||
|
|
||||||
|
$view = Views::getView('watchdog');
|
||||||
|
$data = $view->storage->toArray();
|
||||||
|
$area = $data['display']['default']['display_options']['empty']['area'];
|
||||||
|
|
||||||
|
$this->assertEqual('text_custom', $area['plugin_id']);
|
||||||
|
$this->assertEqual('area_text_custom', $area['field']);
|
||||||
|
$this->assertEqual('No log messages available.', $area['content']);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
Loading…
Reference in New Issue