Problem/Motivation

This was uncovered by #2916898: Do not use basic_html text format for 'No log messages available.' message.

If you add a custom text with a text format to a views area (for example the empty text of many views), the view will not have a dependency on that text format, so that it will break when that text format is missing.

Proposed resolution

Add a dependency on the text format.

Issue fork drupal-2917817

Command icon Show commands

Start within a Git clone of the project using the version control instructions.

Or, if you do not have SSH keys set up on git.drupalcode.org:

Comments

tstoeckler created an issue. See original summary.

tstoeckler’s picture

StatusFileSize
new3.2 KB
tstoeckler’s picture

Status: Active » Needs review

Status: Needs review » Needs work

The last submitted patch, 2: 2917817-2.patch, failed testing. View results

jhodgdon’s picture

I was looking at this patch because of #2928351: Make sure filter dependency is in the help topic configuration, where we need to do something similar.

Just as a note... the calculateDependencies() method is supposed to add dependencies to $this->dependencies and then return $this. See
https://api.drupal.org/api/drupal/core%21lib%21Drupal%21Core%21Config%21...

That is most likely why your tests failed on this patch...

jhodgdon’s picture

Oh wait, sorry, that is for config entities and this is a plugin... may not apply...

Version: 8.4.x-dev » 8.5.x-dev

Drupal 8.4.4 was released on January 3, 2018 and is the final full bugfix release for the Drupal 8.4.x series. Drupal 8.4.x will not receive any further development aside from critical and security fixes. Sites should prepare to update to 8.5.0 on March 7, 2018. (Drupal 8.5.0-alpha1 is available for testing.)

Bug reports should be targeted against the 8.5.x-dev branch from now on, and new development or disruptive changes should be targeted against the 8.6.x-dev branch. For more information see the Drupal 8 minor version schedule and the Allowed changes during the Drupal 8 release cycle.

Version: 8.5.x-dev » 8.6.x-dev

Drupal 8.5.6 was released on August 1, 2018 and is the final bugfix release for the Drupal 8.5.x series. Drupal 8.5.x will not receive any further development aside from security fixes. Sites should prepare to update to 8.6.0 on September 5, 2018. (Drupal 8.6.0-rc1 is available for testing.)

Bug reports should be targeted against the 8.6.x-dev branch from now on, and new development or disruptive changes should be targeted against the 8.7.x-dev branch. For more information see the Drupal 8 minor version schedule and the Allowed changes during the Drupal 8 release cycle.

Version: 8.6.x-dev » 8.8.x-dev

Drupal 8.6.x will not receive any further development aside from security fixes. Bug reports should be targeted against the 8.8.x-dev branch from now on, and new development or disruptive changes should be targeted against the 8.9.x-dev branch. For more information see the Drupal 8 and 9 minor version schedule and the Allowed changes during the Drupal 8 and 9 release cycles.

Version: 8.8.x-dev » 8.9.x-dev

Drupal 8.8.7 was released on June 3, 2020 and is the final full bugfix release for the Drupal 8.8.x series. Drupal 8.8.x will not receive any further development aside from security fixes. Sites should prepare to update to Drupal 8.9.0 or Drupal 9.0.0 for ongoing support.

Bug reports should be targeted against the 8.9.x-dev branch from now on, and new development or disruptive changes should be targeted against the 9.1.x-dev branch. For more information see the Drupal 8 and 9 minor version schedule and the Allowed changes during the Drupal 8 and 9 release cycles.

Version: 8.9.x-dev » 9.2.x-dev

Drupal 8 is end-of-life as of November 17, 2021. There will not be further changes made to Drupal 8. Bugfixes are now made to the 9.3.x and higher branches only. For more information see the Drupal core minor version schedule and the Allowed changes during the Drupal core release cycle.

Version: 9.2.x-dev » 9.3.x-dev

Version: 9.3.x-dev » 9.4.x-dev

Drupal 9.3.15 was released on June 1st, 2022 and is the final full bugfix release for the Drupal 9.3.x series. Drupal 9.3.x will not receive any further development aside from security fixes. Drupal 9 bug reports should be targeted for the 9.4.x-dev branch from now on, and new development or disruptive changes should be targeted for the 9.5.x-dev branch. For more information see the Drupal core minor version schedule and the Allowed changes during the Drupal core release cycle.

Version: 9.4.x-dev » 9.5.x-dev

Drupal 9.4.9 was released on December 7, 2022 and is the final full bugfix release for the Drupal 9.4.x series. Drupal 9.4.x will not receive any further development aside from security fixes. Drupal 9 bug reports should be targeted for the 9.5.x-dev branch from now on, and new development or disruptive changes should be targeted for the 10.1.x-dev branch. For more information see the Drupal core minor version schedule and the Allowed changes during the Drupal core release cycle.

mstrelan’s picture

Version: 9.5.x-dev » 10.1.x-dev
Issue tags: +Bug Smash Initiative
+++ b/core/modules/views/src/Plugin/views/area/Text.php
@@ -14,6 +16,43 @@
+  public function __construct(array $configuration, $plugin_id, $plugin_definition, EntityTypeManagerInterface $entity_type_manager) {

Should we deprecate calling this without an EntityTypeManager?

Version: 10.1.x-dev » 11.x-dev

Drupal core is moving towards using a “main” branch. As an interim step, a new 11.x branch has been opened, as Drupal.org infrastructure cannot currently fully support a branch named main. New developments and disruptive changes should now be targeted for the 11.x branch, which currently accepts only minor-version allowed changes. For more information, see the Drupal core minor version schedule and the Allowed changes during the Drupal core release cycle.

dcam made their first commit to this issue’s fork.

dcam’s picture

Status: Needs work » Needs review
Issue tags: -Needs tests

I converted the patch in #2 to an MR. Then I fixed it because the return value from calculateDependencies() was incorrect. I added a test. At some point I realized that this needed an update path. So I wrote that and added a test for it too.

I did not address the question in #13. I wasn't sure if it's necessary since plugins are @internal.

mrdalesmith’s picture

Change applies cleanly, test pass and the correct dependency is now added to the exported config. I think this is OK to go.

smustgrave’s picture

Status: Needs review » Needs work

Probably need to update any default views that ship with core to include these. Example views.view.frontpage.yml in node, there may be others.

dcam’s picture

Results of grep -rn "plugin_id: text$" --include views.view.*.yml:

core/profiles/demo_umami/config/install/views.view.frontpage.yml:303:          plugin_id: text
core/profiles/demo_umami/config/install/views.view.frontpage.yml:373:          plugin_id: text
core/modules/content_translation/tests/modules/content_translation_test_views/test_views/views.view.test_entity_translations_link.yml:104:          plugin_id: text
core/modules/views/tests/fixtures/update/views.view.test_filter_format_dependencies.yml:164:          plugin_id: text
core/modules/views/tests/fixtures/update/views.view.test_entity_id_argument_update.yml:193:          plugin_id: text
core/modules/views/tests/modules/views_test_config/test_views/views.view.test_display_empty.yml:34:          plugin_id: text
core/modules/views/tests/modules/views_test_config/test_views/views.view.test_display_empty.yml:40:          plugin_id: text
core/modules/views/tests/modules/views_test_config/test_views/views.view.test_entity_id_argument.yml:160:          plugin_id: text
core/modules/views/tests/modules/views_test_config/test_views/views.view.test_tokens.yml:109:          plugin_id: text
core/modules/views/tests/modules/views_test_config/test_views/views.view.test_tokens.yml:141:          plugin_id: text
core/modules/views/tests/modules/views_test_config/test_views/views.view.test_destroy.yml:50:          plugin_id: text
core/modules/views/tests/modules/views_test_config/test_views/views.view.test_destroy.yml:56:          plugin_id: text
core/modules/views/tests/modules/views_test_config/test_views/views.view.test_destroy.yml:148:          plugin_id: text
core/modules/views/tests/modules/views_test_config/test_views/views.view.test_destroy.yml:154:          plugin_id: text
core/modules/views/tests/modules/views_test_config/test_views/views.view.test_destroy.yml:161:          plugin_id: text
core/modules/views/tests/modules/views_test_config/test_views/views.view.test_destroy.yml:167:          plugin_id: text
core/modules/views/tests/modules/views_test_config/test_views/views.view.test_token_view.yml:205:          plugin_id: text
core/modules/views_ui/tests/modules/views_ui_test/config/install/views.view.sa_contrib_2013_035.yml:178:          plugin_id: text
dcam’s picture

Status: Needs work » Needs review

Not all of those views specified the content of the text, so there was nothing to update in those cases. But I updated the ones that needed a dependency.

smustgrave’s picture

Status: Needs review » Reviewed & tested by the community

Believe all views in core have been addressed, double checked that views.view.front in node actually didn't have any format use also (just to follow up on #22)

needs-review-queue-bot’s picture

Status: Reviewed & tested by the community » Needs work
StatusFileSize
new91 bytes

The Needs Review Queue Bot tested this issue. It no longer applies to Drupal core. Therefore, this issue status is now "Needs work".

This does not mean that the patch necessarily needs to be re-rolled or the MR rebased. Read the Issue Summary, the issue tags and the latest discussion here to determine what needs to be done.

Consult the Drupal Contributor Guide to find step-by-step guides for working with issues.

dcam’s picture

Status: Needs work » Reviewed & tested by the community

Restoring RTBC status

xjm’s picture

It even has an upgrade path test. Excellent.

Saving issue credits.

xjm’s picture

Regarding #15:

Should we deprecate calling this without an EntityTypeManager?

I think since it has a factory method, BC-and-deprecation for the constructor might not be necessary. But I will confirm.

xjm credited larowlan.

xjm’s picture

Status: Reviewed & tested by the community » Needs work
Issue tags: +Needs change record

OK, I asked in committer Slack about the constructor deprecation, and got feedback from @larowlan:

I would ask for it - even though the policy doesn't require it.
It takes us not much effort and makes minor to minor updates less painful

...Which is what I'm more comfortable with anyway; I was just trying not to be over-restrictive or NW unnecessarily in case we had become less restrictive about this since I last worked the RTBC queue. 😀

So let's add a default null value and a deprecation to the constructor. However, it does not require a deprecation test, nor a change record mention of the added service.

...Though, we probably should have a change record of the added config dependency. Generally, anything that needs an upgrade path also wants a CR.

Thanks everyone!

dcam’s picture

Issue tags: -Needs change record

I added the change record. I haven't addressed other feedback yet.

xjm’s picture

As always, @mstrelan, a really great catch!

The question about what to do in calculateDependencies() with invalid data gets us into subsystem/release/framework manager review territory. I can't decide which and I'm two of the three, so let's put these two tags on for now, to make sure we take a close look at the decisions we make about this before an eventual commit.

First, though:

  1. Let's address the deprecation stuff to get that out of the way.
  2. Let's get folks' feedback/info on the thread from @mstrelan's point on calculateDependencies().

Then, we can decide exactly what to do about calculateDependencies() and what we need to add for handling existing broken views.

Thanks everyone!

Version: 11.x-dev » main

Drupal core is now using the main branch as the primary development branch. New developments and disruptive changes should now be targeted to the main branch.

Read more in the announcement.

wim leers’s picture

wim leers’s picture

Title: Views text area plugin does not declare a dependency on the text format it uses » [PP-1] Views text area plugin does not declare a dependency on the text format it uses
Status: Needs work » Postponed

Looked into updating/fixing this MR. But then I noticed this probably should be postponed.

godotislate’s picture

Title: [PP-1] Views text area plugin does not declare a dependency on the text format it uses » Views text area plugin does not declare a dependency on the text format it uses
Status: Postponed » Needs work