Commit cf4a6098 authored by catch's avatar catch

Issue #2409413 by cafuego, longwave, lokapujya, alexpott, alvar0hurtad0,...

Issue #2409413 by cafuego, longwave, lokapujya, alexpott, alvar0hurtad0, SivaprasadC, snehi, vipul.patil7888, ayushmishra206, dawehner, xjm, mradcliffe: Remove fields that do nothing from the  "RSS publishing" settings form
parent f32886bf
...@@ -161,14 +161,13 @@ public function getFeedEditObject($feed_url = NULL, array $values = []) { ...@@ -161,14 +161,13 @@ public function getFeedEditObject($feed_url = NULL, array $values = []) {
public function getDefaultFeedItemCount() { public function getDefaultFeedItemCount() {
// Our tests are based off of rss.xml, so let's find out how many elements // Our tests are based off of rss.xml, so let's find out how many elements
// should be related. // should be related.
$feed_count = \Drupal::entityQuery('node') return \Drupal::entityQuery('node')
->condition('promote', NodeInterface::PROMOTED) ->condition('promote', NodeInterface::PROMOTED)
->condition('status', NodeInterface::PUBLISHED) ->condition('status', NodeInterface::PUBLISHED)
->accessCheck(FALSE) ->accessCheck(FALSE)
->range(0, $this->config('system.rss')->get('items.limit')) ->range(0, 10)
->count() ->count()
->execute(); ->execute();
return min($feed_count, 10);
} }
/** /**
......
...@@ -502,8 +502,6 @@ public function testTranslateOperationInListUi() { ...@@ -502,8 +502,6 @@ public function testTranslateOperationInListUi() {
$this->doSettingsPageTest('admin/config/system/site-information'); $this->doSettingsPageTest('admin/config/system/site-information');
// Test the account settings page. // Test the account settings page.
$this->doSettingsPageTest('admin/config/people/accounts'); $this->doSettingsPageTest('admin/config/people/accounts');
// Test the RSS settings page.
$this->doSettingsPageTest('admin/config/services/rss-publishing');
} }
} }
...@@ -888,11 +888,6 @@ public function testAlterInfo() { ...@@ -888,11 +888,6 @@ public function testAlterInfo() {
$this->container->get('state')->set('config_translation_test_config_translation_info_alter', TRUE); $this->container->get('state')->set('config_translation_test_config_translation_info_alter', TRUE);
$this->container->get('plugin.manager.config_translation.mapper')->clearCachedDefinitions(); $this->container->get('plugin.manager.config_translation.mapper')->clearCachedDefinitions();
// Check out if the translation page has the altered in settings.
$this->drupalGet('admin/config/system/site-information/translate/fr/add');
$this->assertText('Feed channel');
$this->assertText('Feed description');
// Check if the translation page does not have the altered out settings. // Check if the translation page does not have the altered out settings.
$this->drupalGet('admin/config/people/accounts/translate/fr/add'); $this->drupalGet('admin/config/people/accounts/translate/fr/add');
$this->assertText('Name'); $this->assertText('Name');
......
...@@ -469,7 +469,6 @@ public function testGetConfigData() { ...@@ -469,7 +469,6 @@ public function testGetConfigData() {
], ],
'system.rss' => [ 'system.rss' => [
'items' => [ 'items' => [
'limit' => 10,
'view_mode' => 'rss', 'view_mode' => 'rss',
], ],
], ],
......
channel:
description: ''
items: items:
limit: 10
view_mode: rss view_mode: rss
langcode: en
...@@ -196,20 +196,10 @@ system.rss: ...@@ -196,20 +196,10 @@ system.rss:
type: config_object type: config_object
label: 'Feed settings' label: 'Feed settings'
mapping: mapping:
channel:
type: mapping
label: 'Feed channel'
mapping:
description:
type: text
label: 'Feed description'
items: items:
type: mapping type: mapping
label: 'Feed items' label: 'Feed items'
mapping: mapping:
limit:
type: integer
label: 'Feed item limit'
view_mode: view_mode:
type: string type: string
label: 'Feed content' label: 'Feed content'
......
...@@ -7,11 +7,9 @@ migration_tags: ...@@ -7,11 +7,9 @@ migration_tags:
source: source:
plugin: variable plugin: variable
variables: variables:
- feed_default_items
- feed_item_length - feed_item_length
source_module: system source_module: system
process: process:
'items/limit': feed_default_items
'items/view_mode': feed_item_length 'items/view_mode': feed_item_length
destination: destination:
plugin: config plugin: config
......
...@@ -30,25 +30,10 @@ protected function getEditableConfigNames() { ...@@ -30,25 +30,10 @@ protected function getEditableConfigNames() {
* {@inheritdoc} * {@inheritdoc}
*/ */
public function buildForm(array $form, FormStateInterface $form_state) { public function buildForm(array $form, FormStateInterface $form_state) {
$rss_config = $this->config('system.rss');
$form['feed_description'] = [
'#type' => 'textarea',
'#title' => t('Feed description'),
'#default_value' => $rss_config->get('channel.description'),
'#description' => t('Description of your site, included in each feed.'),
];
$options = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 15, 20, 25, 30];
$form['feed_default_items'] = [
'#type' => 'select',
'#title' => t('Number of items in each feed'),
'#default_value' => $rss_config->get('items.limit'),
'#options' => array_combine($options, $options),
'#description' => t('Default number of items to include in each feed.'),
];
$form['feed_view_mode'] = [ $form['feed_view_mode'] = [
'#type' => 'select', '#type' => 'select',
'#title' => t('Feed content'), '#title' => t('Feed content'),
'#default_value' => $rss_config->get('items.view_mode'), '#default_value' => $this->config('system.rss')->get('items.view_mode'),
'#options' => [ '#options' => [
'title' => t('Titles only'), 'title' => t('Titles only'),
'teaser' => t('Titles plus teaser'), 'teaser' => t('Titles plus teaser'),
...@@ -65,8 +50,6 @@ public function buildForm(array $form, FormStateInterface $form_state) { ...@@ -65,8 +50,6 @@ public function buildForm(array $form, FormStateInterface $form_state) {
*/ */
public function submitForm(array &$form, FormStateInterface $form_state) { public function submitForm(array &$form, FormStateInterface $form_state) {
$this->config('system.rss') $this->config('system.rss')
->set('channel.description', $form_state->getValue('feed_description'))
->set('items.limit', $form_state->getValue('feed_default_items'))
->set('items.view_mode', $form_state->getValue('feed_view_mode')) ->set('items.view_mode', $form_state->getValue('feed_view_mode'))
->save(); ->save();
......
...@@ -168,3 +168,14 @@ function system_post_update_schema_version_int() { ...@@ -168,3 +168,14 @@ function system_post_update_schema_version_int() {
} }
} }
} }
/**
* Remove obsolete system.rss configuration.
*/
function system_post_update_delete_rss_settings() {
\Drupal::configFactory()->getEditable('system.rss')
->clear('channel')
->clear('items.limit')
->clear('langcode')
->save();
}
...@@ -91,16 +91,9 @@ class MigrateSystemConfigurationTest extends MigrateDrupal6TestBase { ...@@ -91,16 +91,9 @@ class MigrateSystemConfigurationTest extends MigrateDrupal6TestBase {
'stale_file_threshold' => 2592000, 'stale_file_threshold' => 2592000,
], ],
'system.rss' => [ 'system.rss' => [
// channel is not handled by the migration.
'channel' => [
'description' => '',
],
'items' => [ 'items' => [
'limit' => 10,
'view_mode' => 'title', 'view_mode' => 'title',
], ],
// langcode is not handled by the migration.
'langcode' => 'en',
], ],
'system.site' => [ 'system.site' => [
// uuid is not handled by the migration. // uuid is not handled by the migration.
......
...@@ -94,14 +94,9 @@ class MigrateSystemConfigurationTest extends MigrateDrupal7TestBase { ...@@ -94,14 +94,9 @@ class MigrateSystemConfigurationTest extends MigrateDrupal7TestBase {
'stale_file_threshold' => 2592000, 'stale_file_threshold' => 2592000,
], ],
'system.rss' => [ 'system.rss' => [
'channel' => [
'description' => '',
],
'items' => [ 'items' => [
'limit' => 27,
'view_mode' => 'fulltext', 'view_mode' => 'fulltext',
], ],
'langcode' => 'en',
], ],
'system.site' => [ 'system.site' => [
// uuid is not handled by the migration. // uuid is not handled by the migration.
......
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