diff --git a/aggregator.install b/aggregator.install index c646717ec087bcc3a28cde92d66373c93e4146ba..1e063de73ce4a892bbad1d2a39a4ebce787e1354 100644 --- a/aggregator.install +++ b/aggregator.install @@ -61,6 +61,15 @@ function aggregator_update_8601() { $view_config->save(); } +/** + * Remove the teaser_length admin setting. + */ +function aggregator_update_8602() { + $settings = \Drupal::configFactory()->getEditable('aggregator.settings'); + $settings->clear('items.teaser_length') + ->save(); +} + /** * Determines whether the RSS view config has been altered from the default. * diff --git a/config/install/aggregator.settings.yml b/config/install/aggregator.settings.yml index be3a2017940a5fdb36519972da730288c7c65e28..20c446254471b3db07b3d41bf55923b1125d00c6 100644 --- a/config/install/aggregator.settings.yml +++ b/config/install/aggregator.settings.yml @@ -4,7 +4,6 @@ processors: - aggregator items: allowed_html: '<a> <b> <br> <dd> <dl> <dt> <em> <i> <li> <ol> <p> <strong> <u> <ul>' - teaser_length: 600 expire: 9676800 source: list_max: 3 diff --git a/config/schema/aggregator.schema.yml b/config/schema/aggregator.schema.yml index eb6c006f62544fa7c529c23c21f0f626ed0888a9..7d14ad92e0f34f042944809e9cef41d63b63760b 100644 --- a/config/schema/aggregator.schema.yml +++ b/config/schema/aggregator.schema.yml @@ -23,9 +23,6 @@ aggregator.settings: allowed_html: type: string label: 'Allowed HTML tags' - teaser_length: - type: integer - label: 'Length of trimmed description' expire: type: integer label: 'Discard items older than' diff --git a/migrations/d6_aggregator_settings.yml b/migrations/d6_aggregator_settings.yml index a620f69eaf673ec33810e95a2b56120c3a14ed4d..ed2e82c83ccf808bdf8e7bac31d26bd5d08b979a 100644 --- a/migrations/d6_aggregator_settings.yml +++ b/migrations/d6_aggregator_settings.yml @@ -10,7 +10,6 @@ source: - aggregator_parser - aggregator_processors - aggregator_allowed_html_tags - - aggregator_teaser_length - aggregator_clear - aggregator_summary_items source_module: aggregator @@ -19,7 +18,6 @@ process: parser: aggregator_parser processors: aggregator_processors 'items/allowed_html': aggregator_allowed_html_tags - 'items/teaser_length': aggregator_teaser_length 'items/expire': aggregator_clear 'source/list_max': aggregator_summary_items destination: diff --git a/migrations/d7_aggregator_settings.yml b/migrations/d7_aggregator_settings.yml index 3e4583ef84223f439ea256f10b9aecc7be8c31a8..8aadc1c62613eb75b4bc415d31d3ef900d477aa2 100644 --- a/migrations/d7_aggregator_settings.yml +++ b/migrations/d7_aggregator_settings.yml @@ -10,7 +10,6 @@ source: - aggregator_parser - aggregator_processors - aggregator_allowed_html_tags - - aggregator_teaser_length - aggregator_clear - aggregator_summary_items source_module: aggregator @@ -19,7 +18,6 @@ process: parser: aggregator_parser processors: aggregator_processors 'items/allowed_html': aggregator_allowed_html_tags - 'items/teaser_length': aggregator_teaser_length 'items/expire': aggregator_clear 'source/list_max': aggregator_summary_items destination: diff --git a/src/Plugin/aggregator/processor/DefaultProcessor.php b/src/Plugin/aggregator/processor/DefaultProcessor.php index 53c42cc89133444ff6229908af738dcf6ebf0e02..7b43b1fc29f798ef593cc932d0fe1fa75db7a487 100644 --- a/src/Plugin/aggregator/processor/DefaultProcessor.php +++ b/src/Plugin/aggregator/processor/DefaultProcessor.php @@ -166,18 +166,6 @@ class DefaultProcessor extends AggregatorPluginSettingsBase implements Processor '#description' => t('Requires a correctly configured <a href=":cron">cron maintenance task</a>.', [':cron' => Url::fromRoute('system.status')->toString()]), ]; - $lengths = [0, 200, 400, 600, 800, 1000, 1200, 1400, 1600, 1800, 2000]; - $options = array_map(function ($length) { - return ($length == 0) ? t('Unlimited') : $this->formatPlural($length, '1 character', '@count characters'); - }, array_combine($lengths, $lengths)); - - $form['processors'][$info['id']]['aggregator_teaser_length'] = [ - '#type' => 'select', - '#title' => t('Length of trimmed description'), - '#default_value' => $config->get('items.teaser_length'), - '#options' => $options, - '#description' => t('The maximum number of characters used in the trimmed version of content.'), - ]; return $form; } @@ -186,7 +174,6 @@ class DefaultProcessor extends AggregatorPluginSettingsBase implements Processor */ public function submitConfigurationForm(array &$form, FormStateInterface $form_state) { $this->configuration['items']['expire'] = $form_state->getValue('aggregator_clear'); - $this->configuration['items']['teaser_length'] = $form_state->getValue('aggregator_teaser_length'); $this->configuration['source']['list_max'] = $form_state->getValue('aggregator_summary_items'); // @todo Refactor aggregator plugins to ConfigEntity so this is not needed. $this->setConfiguration($this->configuration); diff --git a/tests/src/Functional/AggregatorAdminTest.php b/tests/src/Functional/AggregatorAdminTest.php index 6e6ed2b2d7665130e6f90824bd866e505378aa3b..088aa4514b9e913521ec53c4d901e58869831026 100644 --- a/tests/src/Functional/AggregatorAdminTest.php +++ b/tests/src/Functional/AggregatorAdminTest.php @@ -31,7 +31,6 @@ class AggregatorAdminTest extends AggregatorTestBase { 'aggregator_allowed_html_tags' => '<a>', 'aggregator_summary_items' => 10, 'aggregator_clear' => 3600, - 'aggregator_teaser_length' => 200, 'aggregator_fetcher' => 'aggregator_test_fetcher', 'aggregator_parser' => 'aggregator_test_parser', 'aggregator_processors[aggregator_test_processor]' => 'aggregator_test_processor', diff --git a/tests/src/Functional/Update/AggregatorUpdateDeleteTeaserLengthSettingTest.php b/tests/src/Functional/Update/AggregatorUpdateDeleteTeaserLengthSettingTest.php new file mode 100644 index 0000000000000000000000000000000000000000..45c2dc0cba7b46e76c671bdcdce72021550c6599 --- /dev/null +++ b/tests/src/Functional/Update/AggregatorUpdateDeleteTeaserLengthSettingTest.php @@ -0,0 +1,33 @@ +<?php + +namespace Drupal\Tests\aggregator\Functional\Update; + +use Drupal\FunctionalTests\Update\UpdatePathTestBase; + +/** + * @covers aggregator_update_8602() + * @group Update + * @group aggregator + */ +class AggregatorUpdateDeleteTeaserLengthSettingTest extends UpdatePathTestBase { + + /** + * {@inheritdoc} + */ + protected function setDatabaseDumpFiles() { + $this->databaseDumpFiles = [ + DRUPAL_ROOT . '/core/modules/system/tests/fixtures/update/drupal-9.4.0.bare.standard.php.gz', + __DIR__ . '/../../../fixtures/update/aggregator.php', + ]; + } + + /** + * Ensure the items.teaser_length setting is deleted. + */ + public function testUpdateHookN(): void { + $this->runUpdates(); + $settings = \Drupal::config('aggregator.settings'); + $this->assertNull($settings->get('items.teaser_length')); + } + +} diff --git a/tests/src/Kernel/Migrate/d6/MigrateAggregatorConfigsTest.php b/tests/src/Kernel/Migrate/d6/MigrateAggregatorConfigsTest.php index bd3df58e5e8e7b5464639ef90056b32bf6ee87e5..2f520151d2126e7246d4178123b197abfcad374d 100644 --- a/tests/src/Kernel/Migrate/d6/MigrateAggregatorConfigsTest.php +++ b/tests/src/Kernel/Migrate/d6/MigrateAggregatorConfigsTest.php @@ -29,7 +29,6 @@ class MigrateAggregatorConfigsTest extends MigrateDrupal6TestBase { $this->assertSame('aggregator', $config->get('fetcher')); $this->assertSame('aggregator', $config->get('parser')); $this->assertSame(['aggregator'], $config->get('processors')); - $this->assertSame(600, $config->get('items.teaser_length')); $this->assertSame('<a> <b> <br /> <dd> <dl> <dt> <em> <i> <li> <ol> <p> <strong> <u> <ul>', $config->get('items.allowed_html')); $this->assertSame(9676800, $config->get('items.expire')); $this->assertSame(3, $config->get('source.list_max')); diff --git a/tests/src/Kernel/Migrate/d7/MigrateAggregatorSettingsTest.php b/tests/src/Kernel/Migrate/d7/MigrateAggregatorSettingsTest.php index 3b11917e224e9182d02cc673ec358b960f4c4d69..19809eb0339890f1c1f21fc0968e6f72d5b02633 100644 --- a/tests/src/Kernel/Migrate/d7/MigrateAggregatorSettingsTest.php +++ b/tests/src/Kernel/Migrate/d7/MigrateAggregatorSettingsTest.php @@ -27,7 +27,6 @@ class MigrateAggregatorSettingsTest extends MigrateDrupal7TestBase { $this->assertSame('aggregator', $config['parser']); $this->assertSame(['aggregator'], $config['processors']); $this->assertSame('<p> <div> <a>', $config['items']['allowed_html']); - $this->assertSame(500, $config['items']['teaser_length']); $this->assertSame(86400, $config['items']['expire']); $this->assertSame(6, $config['source']['list_max']); }