Problem/Motivation

Sometimes you want to force content-editors to provide a summary. Use case would include

  • You're showing it in a teaser display mode
  • You're using it for the metatag description
  • You're using it for search results

The summary input is easy to miss, but is really useful as it avoids needing a second text field for teaser text.

Proposed resolution

Setup options for the "Text area with a summary" widget to allow for the Summary field to be "Shown by default" (instead of collapsed with js) and a field level setting to make the summary value "Required".

Remaining tasks

  • manual testing (See contributor task doc for instructions on manual testing: http://drupal.org/node/1489010) Especially see #42 on for what combinations to test.
  • Reviews

User interface changes

New checkbox on text with summary widget and text with summary field.

API changes

No api changes.

CommentFileSizeAuthor
#117 Screen Shot 2019-04-02 at 12.13.32 pm.png13.4 KBlarowlan
#117 Screen Shot 2019-04-02 at 12.13.21 pm.png38.56 KBlarowlan
#117 Screen Shot 2019-04-02 at 12.12.44 pm.png28.27 KBlarowlan
#115 interdiff-16ff22.txt739 byteslarowlan
#115 1704864-summary-required-115.patch21.76 KBlarowlan
#112 1704864-summary-required-112.patch21.74 KBlarowlan
#112 1704864-summary-required-112-interdiff.txt20.64 KBlarowlan
#109 1704864-summary-required-105.patch10.62 KBlarowlan
#109 1704864-summary-required-interdiff-104.txt4.18 KBlarowlan
#107 1704864-summary-required-103.patch6.44 KBlarowlan
#107 1704864-summary-required-103-interdiff.txt1.4 KBlarowlan
#103 1704864-summary-required-102.patch6.45 KBlarowlan
#98 text_required_summary.1704864-98.patch2.84 KBkostyashupenko
#82 text_required_summary.1704864-82.patch5.59 KBStalski
#80 text_required_summary.1704864-80.patch5.58 KBStalski
#78 text_required_summary.1704864-78.patch7.86 KBStalski
#70 interdiff-1704864-66-69.txt866 bytesStalski
#70 text_required_summary.1704864-69.patch7.89 KBStalski
#69 interdiff-1704864-66-69.txt866 bytesStalski
#69 text_required_summary.1704864-69.patch7.99 KBStalski
#66 1704864-65-required-and-show-by-default-for-text-summary.patch7.78 KBStalski
#64 1704864-64-required-and-show-by-default-for-text-summary.patch7.87 KBStalski
#60 1704864-60-required-and-show-by-default-for-text-summary.patch3.1 KBStalski
#58 interdiff.txt734 bytesnick_schuch
#58 1704864-58-required-and-show-by-default-for-text-summary.patch4.54 KBnick_schuch
#56 longsummarybefore1.png60.91 KBandymartha
#56 longsummaryafter1.png64.93 KBandymartha
#56 longsummaryafter2.png33.47 KBandymartha
#56 longsummaryafter3.png31.73 KBandymartha
#48 1704864-48-required-and-show-by-default-for-text-summary.interdiff.txt662 bytesnick_schuch
#48 1704864-48-required-and-show-by-default-for-text-summary.patch4.53 KBnick_schuch
#47 1704864-47-required-and-show-by-default-for-text-summary.interdiff.txt2.08 KBnick_schuch
#47 1704864-47-required-and-show-by-default-for-text-summary.patch4.53 KBnick_schuch
#46 summary_required_options.png82.3 KBnick_schuch
#46 summary_required.png71.95 KBnick_schuch
#39 1704864-39-interdiff.txt857 bytesnick_schuch
#39 1704864-39-required-and-show-by-default-for-text-summary.patch4.26 KBnick_schuch
#36 interdiff.txt726 bytesnick_schuch
#36 1704864-36-required-and-show-by-default-for-text-summary.patch4.38 KBnick_schuch
#30 1704864.interdiff.txt1.38 KBnick_schuch
#28 1704864-28-required-and-show-by-default-for-text-summary.patch4.36 KBnick_schuch
#26 1704864-26-required-and-show-by-default-for-text-summary.patch4.37 KBnick_schuch
#24 1704864-24-required-and-show-by-default-for-text-summary.patch4.38 KBnick_schuch
#24 1704864.interdiff.txt1.82 KBnick_schuch
#21 1704864-21-required-and-show-by-default-for-text-summary.patch4.35 KBnick_schuch
#21 1704864.interdiff.txt2.89 KBnick_schuch
#19 1704864-19-required-and-show-by-default-for-text-summary.patch4.46 KBnick_schuch
#14 summary_field_visible_and_required.png46.76 KBnick_schuch
#13 1704864-11-required-and-show-by-default-for-text-summary.patch2.76 KBnick_schuch
#7 1704864-required-and-show-by-default-for-text-summary.patch2.71 KBnick_schuch
#1 1704864-required-and-show-by-default-for-text-summary.patch2.65 KBnick_schuch

Comments

nick_schuch’s picture

Attached an implementation of this.

Status: Needs review » Needs work

The last submitted patch, 1704864-required-and-show-by-default-for-text-summary.patch, failed testing.

nick_schuch’s picture

Status: Needs work » Needs review

Status: Needs review » Needs work

The last submitted patch, 1704864-required-and-show-by-default-for-text-summary.patch, failed testing.

nick_schuch’s picture

Status: Needs work » Needs review

Status: Needs review » Needs work

The last submitted patch, 1704864-required-and-show-by-default-for-text-summary.patch, failed testing.

nick_schuch’s picture

Status: Needs work » Needs review
StatusFileSize
new2.71 KB

Second attempt.

tim-e’s picture

Status: Needs review » Reviewed & tested by the community

Tested and reviewed, working perfectly.

catch’s picture

Status: Reviewed & tested by the community » Needs review
Issue tags: +Needs usability review

I'm not sure why this is a useful feature, or what exactly it'll look like when used. Adding 'needs usability review' and 'needs screenshots' tags.

tim.plunkett’s picture

Issue tags: +Needs screenshots

Fixing tag

Bojhan’s picture

Issue tags: -Needs usability review

Can't review. Needs screen.

bulldozer2003’s picture

I was just looking for this in 7. Going to backport it as a module for my own use.

nick_schuch’s picture

I have rerolled that patch as the text module has been taken out of field module.

nick_schuch’s picture

StatusFileSize
new46.76 KB

Catch, I have attached a screenshot of what this looks like when the following settings are selected:

- Show Summary
- Mark Summary as required

larowlan’s picture

Here's the screenshot from #14
Screenshot

Having this feature means instead of adding two fields to a content type (eg a body and a teaser), you can just force the body field to display the summary field and make it required (editors regularly miss the 'show summary' link). Then you can use that as the teaser.

I think its a worthy feature, but it need tests.

larowlan’s picture

Also the description 'leave blank' needs to be changed when the required flag is set.

larowlan’s picture

Issue tags: +Needs usability review

Adding back ux tag

Bojhan’s picture

Issue tags: -Needs usability review

Looks fine.

nick_schuch’s picture

Written tests to check for required summary field. Also actioned #16 request of "Also the description 'leave blank' needs to be changed when the required flag is set.".

larowlan’s picture

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

This looks great, and now with tests.
Down to minor nitpicks now.

+++ b/core/modules/text/lib/Drupal/text/Plugin/field/widget/TextareaWithSummaryWidget.phpundefined
@@ -36,19 +36,23 @@ function formElement(array $items, $delta, array $element, $langcode, array &$fo
+    $required = empty($form['#type']) && !empty($this->instance['settings']['required_summary']) ? TRUE : FALSE;

This can be simplified to $required = (empty($form['#type']) && !empty($this->instance['settings']['required_summary']));

+++ b/core/modules/text/lib/Drupal/text/Plugin/field/widget/TextareaWithSummaryWidget.phpundefined
@@ -36,19 +36,23 @@ function formElement(array $items, $delta, array $element, $langcode, array &$fo
-        'js' => array(drupal_get_path('module', 'text') . '/text.js'),

Do we need a followup to make this use libraries instead since #1737148: Explicitly declare all JS dependencies, don't use drupal_add_js, will ask nod_

+++ b/core/modules/text/lib/Drupal/text/Tests/TextSummaryTest.phpundefined
@@ -180,4 +181,29 @@ function testOnlyTextSummary() {
+    $summary = $this->randomName();

I don't think this is used?

+++ b/core/modules/text/lib/Drupal/text/Tests/TextSummaryTest.phpundefined
@@ -180,4 +181,29 @@ function testOnlyTextSummary() {
+    $this->assertText('Summary field is required.', 'Article with no summary when summary is required cannot be saved.');

Nitpick but the assertion message is confusing. How about 'Unable to save article without a required summary' or something else, not fussy.

+++ b/core/modules/text/text.moduleundefined
@@ -108,6 +108,18 @@ function text_field_instance_settings_form($field, $instance) {
+      '#default_value' => !empty($settings['show_summary']) ? TRUE : FALSE,

Again, this can be simplified to !empty($settings['show_summary'])

+++ b/core/modules/text/text.moduleundefined
@@ -108,6 +108,18 @@ function text_field_instance_settings_form($field, $instance) {
+      '#description' => t('Remove collapse option to who the Summary.'),

Text here is wrong. Suggest 'Summary field is always visible' or similar.

+++ b/core/modules/text/text.moduleundefined
@@ -108,6 +108,18 @@ function text_field_instance_settings_form($field, $instance) {
+      '#default_value' => !empty($settings['required_summary']) ? TRUE : FALSE,

This can be simplified too

+++ b/core/modules/text/text.moduleundefined
@@ -108,6 +108,18 @@ function text_field_instance_settings_form($field, $instance) {
+      '#description' => t('Marks the Summary as required.'),

Mark not marks

nick_schuch’s picture

Status: Needs work » Needs review
StatusFileSize
new2.89 KB
new4.35 KB

Thanks larowlan!

Have made the changes and provided an interdiff.

larowlan’s picture

Status: Needs review » Reviewed & tested by the community

Assuming bot comes back green, this looks good to go

tim.plunkett’s picture

Status: Reviewed & tested by the community » Needs work
+++ b/core/modules/text/lib/Drupal/text/Plugin/field/widget/TextareaWithSummaryWidget.phpundefined
@@ -36,19 +36,23 @@ function formElement(array $items, $delta, array $element, $langcode, array &$fo
+    $js = empty($this->instance['settings']['show_summary']) ? array(drupal_get_path('module', 'text') . '/text.js') : array();
...
+        'js' => $js,

This will cause drupal_process_attached() to be called even when it doesn't need to be.

Instead it should be something like this, after the initial element is made

if (empty($this->instance['settings']['show_summary'])) {
 $element['summary']['#attached']['js'][] = drupal_get_path('module', 'text') . '/text.js';
}
nick_schuch’s picture

Status: Needs work » Needs review
StatusFileSize
new1.82 KB
new4.38 KB

Thanks tim.plunkett

I have attached the update and with its respective interdiff. I have also setup a follow up for text module to use hook_library_info for the loading of text.js here #1888744: text.module missing text_library_info() - does not explicitly declare js dependencies.

tim.plunkett’s picture

Status: Needs review » Reviewed & tested by the community

['js'] = array( vs ['js'][] would be a problem if this wasn't for an element we just finished making, so this is good. Thanks @nick_schuch!

Setting back to RTBC per #22.

nick_schuch’s picture

Status: Reviewed & tested by the community » Needs review
StatusFileSize
new4.37 KB
webchick’s picture

Sorry; since that one was a straight-up bug fix and this one is a feature and blocked on thresholds, it seemed more prudent to commit it first.

nick_schuch’s picture

Hi webchick, not a problem. Thanks for committing my other patch. Just found an issue in my current reroll :)

$element['summary']['#attached']['library'] = 'library' => array(array('text', 'drupal.text'));

Have fixed in this patch.

larowlan’s picture

Can we get an interdiff if possible?

nick_schuch’s picture

StatusFileSize
new1.38 KB

No probs larowlan. Here's the interdiff for #28 after rerolling against latest 8.x branch.

larowlan’s picture

Status: Needs review » Reviewed & tested by the community

And we're back

effulgentsia’s picture

Component: other » text.module
webchick’s picture

Issue tags: +RTBC Feb 18

There've been lots of changes to this part of the code recently, so going for another testbot run.

In case it doesn't finish before I go to bed, tagging as something that was RTBC in time for feature freeze.

webchick’s picture

Status: Reviewed & tested by the community » Needs work
Issue tags: +RTBC Feb 18

The last submitted patch, 1704864-28-required-and-show-by-default-for-text-summary.patch, failed testing.

nick_schuch’s picture

Status: Needs work » Needs review
StatusFileSize
new4.38 KB
new726 bytes

Looks like it was just a case of permissions moving on.

larowlan’s picture

Status: Needs review » Reviewed & tested by the community

This is good to go again.
Also helps with proposed solution from @yched at #626546-62: The body field on the Basic Page content type should not allow a summary to be input

webchick’s picture

Status: Reviewed & tested by the community » Needs work

Two small things, then this looks good to go:

+++ b/core/modules/text/text.moduleundefined
@@ -128,6 +128,18 @@ function text_field_instance_settings_form($field, $instance) {
+      '#title' => t('Show Summary'),
...
+      '#description' => t('Summary field is always visible.'),

Not sure "Show summary" is obvious enough that that's what that means? How about "Always show summary" and ditch the description?

+++ b/core/modules/text/text.moduleundefined
@@ -128,6 +128,18 @@ function text_field_instance_settings_form($field, $instance) {
+      '#title' => t('Mark Summary as required'),
...
+      '#description' => t('Mark the Summary as required.'),

:)

Don't need a description that says exactly what the field title is. :) Also we could shorten this to just "Require summary"

nick_schuch’s picture

Status: Needs work » Needs review
StatusFileSize
new4.26 KB
new857 bytes

Here are the recommended fixed as identified by webchick. Thanks webchick!

larowlan’s picture

Status: Needs review » Reviewed & tested by the community

Fixed as requested

xjm’s picture

xjm’s picture

Status: Reviewed & tested by the community » Needs work

I've discovered a bug unfortunately. :(

  1. Use Chrome. (I think this matters because of HTML5 validation.)
  2. On a fresh install of D8 standard with the patch applied, edit the article body field and check "Require summary".
  3. Create a new article. Fill in the title and body without clicking "Edit summary".
  4. Try to submit the form. Nothing happens--it fails on HTML validation, but the failure is invisible because the field is hidden.

So, we need to fix the JS to show the field when that happens.

xjm’s picture

Also, it would be good to add some screenshots: the field instance settings with the patch applied, the summary failing validation, the "always show" behavior, etc.

alexverb’s picture

This might have do do something with the WYSIWYG editor on top. There's a similar issue here: http://drupal.org/node/1338956 But it has to be fixed upstream by the editors. I tried raising the issue at ckeditor, but my voice doesn't carry enough weight. That's why I provided a workaround.

If it's only the summary field without the editor you might just want to add a "novalidate" property to the textarea input so HTML5 validation doesn't catch it. I'm not a big fan of browsers HTML5 validation. In fact I think Drupal should provide a checkbox to disable it entirely. Unless the browser also wants to take over the theming for us :)

xjm’s picture

I actually think that when the summary is required, the option to hide/show should go away and the field should always be shown.

nick_schuch’s picture

Status: Needs work » Needs review
StatusFileSize
new71.95 KB
new82.3 KB

Thanks xjm!

Turn's out the summary field being hidden via the javascript also hides the message to state that the summary field is required (when not filled out). I have implemented the suggested option provided by xjm in #45 to resolve.

See the following screenshots:

summary_required_options.png

summary_required.png

nick_schuch’s picture

Here is the patch (woops forgot to add in last comment) and interdiff.

nick_schuch’s picture

nick_schuch’s picture

Also adding back in tags removed in #44.

yesct’s picture

Issue summary: View changes

used issue summary template and added links for new contributors to do tasks

ariley4’s picture

Im going to perform the screenshots for this issue.

ariley4’s picture

I tried to use the simplytest.me with Dreditor and there was an error. Then I tried it without and still received the same error. I dont know what to do.

nick_schuch’s picture

Status: Needs review » Needs work

The last submitted patch, 1704864-48-required-and-show-by-default-for-text-summary.patch, failed testing.

nick_schuch’s picture

Status: Needs work » Needs review

Status: Needs review » Needs work
Issue tags: +Needs screenshots, +Needs manual testing, +RTBC Feb 18

The last submitted patch, 1704864-48-required-and-show-by-default-for-text-summary.patch, failed testing.

andymartha’s picture

StatusFileSize
new31.73 KB
new33.47 KB
new64.93 KB
new60.91 KB

Great job by everyone working on this issue! Here are some screenshots of the issue in question after applying patch 1704864-47-required-and-show-by-default-for-text-summary.patch by nick_schuch in #47
I confirm that the patch hides the "always show summary" option when "require summary" is checked per #46
1) Drupal 8 without the patch
2) Drupal 8 with the patch
3) clicking save and publish does not visibly do anything because the html5 browser error message happens in the hidden summary area
4) older, non-html5 browsers get this message from Drupal with a blank, required summary

longsummarybefore1.png

longsummaryafter1.png

longsummaryafter2.png

longsummaryafter3.png

nick_schuch’s picture

Thanks andymartha! I'll reroll today to make sure the bot comes back green so we can get it RTBC again!

nick_schuch’s picture

Status: Needs work » Needs review
StatusFileSize
new4.54 KB
new734 bytes

Patch to make the tests go green.

star-szr’s picture

Manually tested and screenshots added in #56, removing tags.

Stalski’s picture

Rerolled the patch to make it green again.
I also removed the test for it. It seems a couple of tests (webcasetests) have been removed in favour of unit tests. Do we need this small test for the required fields, any idea's?

nick_schuch’s picture

Thanks for the reroll Stalski.

Can you please provide a interdiff so we can see the changes made between patches?

We will need test coverage. So looks like we will need to do a unit test. :)

Status: Needs review » Needs work

The last submitted patch, 1704864-60-required-and-show-by-default-for-text-summary.patch, failed testing.

Stalski’s picture

Ok, agreed.
I'll try to cover that today.

Stalski’s picture

Assigned: Unassigned » Stalski
Status: Needs work » Needs review
StatusFileSize
new7.87 KB

I did not add an interdiff since it wouldn't add any value. Lots of files were moved etc ... . The old patch does not apply in the new core by miles.

So the unit test is extended so it can check the required summary.

Status: Needs review » Needs work

The last submitted patch, 1704864-64-required-and-show-by-default-for-text-summary.patch, failed testing.

Stalski’s picture

Status: Needs work » Needs review
StatusFileSize
new7.78 KB

Took the diff in the wrong order. Correct patch

nils.destoop’s picture

Status: Needs review » Needs work

Tested this patch, but found one issue.
When the summary is marked as required, and you edit the field again. You are required to enter a summary on the edit field screen.

Stalski’s picture

Thx for the review.
I had that error as well and it went away. The problem is that the extra added element does not go through the widget flow as the field itself does.
There is a quick and easy fix for it to check if we are rendering the default widget or the normal one.
Patch coming up.

Stalski’s picture

Status: Needs work » Needs review
StatusFileSize
new7.99 KB
new866 bytes

The patch and interdiff.

Stalski’s picture

Sorry, had the patch the other way around. New patch / interdiff.

Status: Needs review » Needs work

The last submitted patch, text_required_summary.1704864-69.patch, failed testing.

nils.destoop’s picture

Status: Needs work » Needs review
nils.destoop’s picture

Status: Needs review » Needs work
nils.destoop’s picture

Status: Needs work » Needs review
Issue tags: -RTBC Feb 18

Status: Needs review » Needs work

The last submitted patch, text_required_summary.1704864-69.patch, failed testing.

Stalski’s picture

Status: Needs work » Needs review

#70: text_required_summary.1704864-69.patch queued for re-testing.

With the tests applied, it's all green. Don't know why this is crashing on a fatal error atm.

Status: Needs review » Needs work
Issue tags: +RTBC Feb 18

The last submitted patch, text_required_summary.1704864-69.patch, failed testing.

Stalski’s picture

Status: Needs work » Needs review
StatusFileSize
new7.86 KB

Rerolled it against latest dev.

Status: Needs review » Needs work

The last submitted patch, text_required_summary.1704864-78.patch, failed testing.

Stalski’s picture

Status: Needs work » Needs review
StatusFileSize
new5.58 KB

Rerolled again.

Status: Needs review » Needs work

The last submitted patch, text_required_summary.1704864-80.patch, failed testing.

Stalski’s picture

Status: Needs work » Needs review
StatusFileSize
new5.59 KB

again

The last submitted patch, text_required_summary.1704864-82.patch, failed testing.

Anonymous’s picture

Issue summary: View changes

fix copy and paste error

sun’s picture

This comes very late in the game, but does not appear to have been questioned yet:

Why do we want to enhance the compound textarea+summary field in these substantial ways, if all of your goals are covered by adding a separate summary text field?

The moment you make the summary required, we're really talking about a separate field → proper validation, error messaging, separate values, widget/formatter control, integrations, etc.pp.

It's not clear why we'd want to shoehorn all of that into a compound textarea+summary field?

Thoughts?

Stalski’s picture

Agreed actually, so would we need a separate compound then?

luksak’s picture

Issue summary: View changes

In the meantime there is a contrib module to accomplish this: Summary settings

I had this use case once and agree that this would be useful. Should we leave it contrib or put that in core?

mgifford’s picture

Assigned: Stalski » Unassigned

There has been no new work on this issue in quite some time. So I'm assuming the person assigned is no longer being actively pursuing it. Sincere apologies if this is wrong.

Version: 8.0.x-dev » 8.1.x-dev

Drupal 8.0.6 was released on April 6 and is the final bugfix release for the Drupal 8.0.x series. Drupal 8.0.x will not receive any further development aside from security fixes. Drupal 8.1.0-rc1 is now available and sites should prepare to update to 8.1.0.

Bug reports should be targeted against the 8.1.x-dev branch from now on, and new development or disruptive changes should be targeted against the 8.2.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.1.x-dev » 8.2.x-dev

Drupal 8.1.9 was released on September 7 and is the final bugfix release for the Drupal 8.1.x series. Drupal 8.1.x will not receive any further development aside from security fixes. Drupal 8.2.0-rc1 is now available and sites should prepare to upgrade to 8.2.0.

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

generalredneck’s picture

> Why do we want to enhance the compound textarea+summary field in these substantial ways, if all of your goals are covered by adding a separate summary text field?

I would venture to guess that it's a usability answer here. Taking the optional "Required" setting out of this, making it visible by default would help encourage (or even show users they CAN) add a summary for the teaser. By default the verbiage kinda gets overlooked.

For the required. You are correct. At that point, yeah we are talking about a full on another field. What it means for site builders is they can add in this without having to go reconfigure all the displays and/or templates that currently say "Display the body field"

Not saying that these are compelling reasons. Just thought I would add to this old discussion to see if it spawns any progress and/or decisions other than "Needs Work"

Version: 8.2.x-dev » 8.3.x-dev

Drupal 8.2.6 was released on February 1, 2017 and is the final full bugfix release for the Drupal 8.2.x series. Drupal 8.2.x will not receive any further development aside from critical and security fixes. Sites should prepare to update to 8.3.0 on April 5, 2017. (Drupal 8.3.0-alpha1 is available for testing.)

Bug reports should be targeted against the 8.3.x-dev branch from now on, and new development or disruptive changes should be targeted against the 8.4.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.3.x-dev » 8.4.x-dev

Drupal 8.3.6 was released on August 2, 2017 and is the final full bugfix release for the Drupal 8.3.x series. Drupal 8.3.x will not receive any further development aside from critical and security fixes. Sites should prepare to update to 8.4.0 on October 4, 2017. (Drupal 8.4.0-alpha1 is available for testing.)

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

rcodina’s picture

1) For Drupal 7: https://www.drupal.org/project/text_summary_options
2) Any update on this issue for Drupal 8?

rcodina’s picture

I've just done a port to D8 for text_summary_options module. More details here #2923443: Offering to maintain Summary Options (Drupal 8 version)

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.

larowlan’s picture

Version: 8.6.x-dev » 8.7.x-dev
Issue tags: +Needs reroll
kostyashupenko’s picture

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

Drupal 8.7.0-alpha1 will be released the week of March 11, 2019, which means new developments and disruptive changes should now be targeted against the 8.8.x-dev branch. For more information see the Drupal 8 minor version schedule and the Allowed changes during the Drupal 8 release cycle.

larowlan’s picture

Status: Needs work » Needs review

Status: Needs review » Needs work

The last submitted patch, 98: text_required_summary.1704864-98.patch, failed testing. View results
- codesniffer_fixes.patch Interdiff of automated coding standards fixes only.

larowlan credited irawan.

larowlan’s picture

Status: Needs work » Needs review
StatusFileSize
new6.45 KB

Worked on this with @irawan and @ling-drupal

larowlan’s picture

Status: Needs review » Needs work

The last submitted patch, 103: 1704864-summary-required-102.patch, failed testing. View results

larowlan’s picture

Status: Needs work » Needs review
StatusFileSize
new1.4 KB
new6.44 KB

Status: Needs review » Needs work

The last submitted patch, 107: 1704864-summary-required-103.patch, failed testing. View results

larowlan’s picture

Status: Needs work » Needs review
StatusFileSize
new4.18 KB
new10.62 KB
larowlan’s picture

Assigned: Unassigned » larowlan
Issue summary: View changes
Status: Needs review » Needs work
Issue tags: -Needs issue summary update

OK, self review - I know I RTBC'd this a couple of times in the last 6 years (gasp) but things have changed since then - so I think there are two more changes required.

  1. +++ b/core/modules/text/src/Plugin/Field/FieldType/TextWithSummaryItem.php
    @@ -95,6 +97,23 @@ public function fieldSettingsForm(array $form, FormStateInterface $form_state) {
    +    $element['show_summary'] = [
    +      '#type' => 'checkbox',
    +      '#title' => t('Always show summary'),
    +      '#default_value' => $settings['show_summary'],
    +      '#states' => [
    +        'invisible' => [
    +          'input[name="instance[settings][required_summary]"]' => ['checked' => TRUE],
    +        ],
    +      ],
    +    ];
    

    This belongs on the widget in my opinion

  2. +++ b/core/modules/text/src/Plugin/Field/FieldWidget/TextareaWithSummaryWidget.php
    @@ -64,21 +64,25 @@ public function formElement(FieldItemListInterface $items, $delta, array $elemen
    +      '#required' => $required,
    

    We also need a validation constraint for this, for API clients

larowlan’s picture

We also need an update path now too, to update the configuration

larowlan’s picture

Assigned: larowlan » Unassigned
Status: Needs work » Needs review
StatusFileSize
new20.64 KB
new21.74 KB

Adds update path
Adds test coverage for update path
Adds validation constraint for API clients with the required summary field
Adds test coverage for validation constraint
Moves the show summary from the field settings to the widget settings, as its more appropriate there (its not a data option, its a display option).

larowlan’s picture

Title: Add a "Required" and "Show by default" option for "Text area with a summary" widget. » Add a "Required" and "Show by default" option for "Text area with a summary" field/widget.

Status: Needs review » Needs work

The last submitted patch, 112: 1704864-summary-required-112.patch, failed testing. View results
- codesniffer_fixes.patch Interdiff of automated coding standards fixes only.

larowlan’s picture

Status: Needs work » Needs review
StatusFileSize
new21.76 KB
new739 bytes

Fixed deprecation error from test and phpcs issue

jibran’s picture

Issue tags: +Needs screenshots, +Needs change record

The patch looks good to me nothing to nit pick. Needs screenshot about new settings in UI and error. Needs change record with screenshot and it might need a usablity review for the new string and settings added here.

+++ b/core/modules/text/text.post_update.php
@@ -0,0 +1,49 @@
+  $config_entity_updater->update($sandbox, 'entity_form_display', $widget_callback);
+  $config_entity_updater->update($sandbox, 'field_config', $field_callback);

Conventionally, we perform on config change per hook so that other module can run their changes in between if they want to but in this case, I don't this is necessary.

larowlan’s picture

Added screenshots and a change record

jibran’s picture

Status: Needs review » Reviewed & tested by the community

Thanks, this looks good now.

Status: Reviewed & tested by the community » Needs work

The last submitted patch, 115: 1704864-summary-required-115.patch, failed testing. View results

larowlan’s picture

Status: Needs work » Reviewed & tested by the community

random fail

Exception: Warning: file_put_contents(/var/www/html/sites/simpletest/.htaccess): failed to open stream: Permission denied
file_save_htaccess()() (Line: 376)

Status: Reviewed & tested by the community » Needs work

The last submitted patch, 115: 1704864-summary-required-115.patch, failed testing. View results

yogeshmpawar’s picture

Status: Needs work » Reviewed & tested by the community

Setting back to RTBC!
This is not happening anymore.

catch’s picture

Tagging for usability and product manager review since the last time webchick looked at this was six (!) years ago.

webchick’s picture

Status: Reviewed & tested by the community » Fixed
Issue tags: -Needs usability review, -Needs product manager review

Wow, this is a blast from the past. :)

The use case in the issue summary makes sense to me, and looks like @Bojhan signed off UX-wise in #11 7(!) years ago.

I read through the whole issue, in part to figure out why it took this long to resolve, and it seems like the main objection was @sun in #84, essentially asking what the value of these options are over having two text fields.

I think the value is that, for better or for worse, Drupal has shipped with this Body + Summary field concept since ages ago (Drupal 5?), and there are various parts of the system that make assumptions about that summary field / teaser view (e.g. the default front page view). Adding these settings here mean not having to manually go find all of those places and manually undo their assumptions, to instead utilize a custom "Teaser" field. And in the event that something like #1378350: Clean up the "Long text and summary" field ever happens, it seems like these settings help bring the field further inline with others, and would help make that migration easier.

So with that....

Committed and pushed to 8.8.x! TENACITY OF THE DECADE AWARD, FOLKS!! :D However, I am not planning to backport this to 8.7.x, since it's a "nice to have" vs. a bug fix.

  • webchick committed 7cea08f on 8.8.x
    Issue #1704864 by nick_schuch, Stalski, larowlan, kostyashupenko,...
larowlan’s picture

published change record

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.