Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
Problem/Motivation
If the content type doesn't have either of 'text', 'text_long', 'text_with_summary' field, the node view page throws an error. Moreover readtime may not be desirable for each content type.
Proposed resolution
Add a checkbox on content type edit form to configure readtime per content type
User interface changes
New checkbox under Read time tab on content type edit form.
API changes
By default readtime will be disabled.
Comment | File | Size | Author |
---|---|---|---|
#10 | per-content-type_3053580-10.patch | 8.49 KB | Anas_maw |
#8 | 3053580-add-option-enable-read_time-per-content-type-8.patch | 7.28 KB | DYdave |
#5 | interdiff_2-5.txt | 1.05 KB | andriansyah |
#5 | 3053580-5.patch | 5.93 KB | andriansyah |
#2 | read_time-config_per_type-3053580-2-D8.patch | 5.58 KB | fotuzlab |
Comments
Comment #2
fotuzlab CreditAttribution: fotuzlab commentedHere is a patch.
Comment #3
fotuzlab CreditAttribution: fotuzlab commentedComment #4
fjgarlin CreditAttribution: fjgarlin as a volunteer and commentedFirstly, thanks so much for the patch! Applies cleanly to 8.x-1.x and also works as suggested.
However, `variable_del` is no longer part of the Drupal 8 API so this might need to be changed to be D8 compatible, otherwise it'll throw an exception when uninstalling the module.
Comment #5
andriansyah CreditAttribution: andriansyah as a volunteer and at Alterra commentedhook uninstall removed and changed into
NodeTypeInterface::unsetThirdPartySetting
Comment #6
fjgarlin CreditAttribution: fjgarlin as a volunteer and commentedApplies cleanly and works as described. Thanks.
Comment #7
Anas_maw CreditAttribution: Anas_maw at Coders Enterprise Web & Mobile Solutions commented+1, Patch in #5 works as expected.
Comment #8
DYdave CreditAttribution: DYdave at Code Enigma commentedHi everyone,
Thanks a lot for raising this issue and contributing a patch.
Please find attached to this comment a re-roll of the patch from #5, against the 2.x branch:
3053580-add-option-enable-read_time-per-content-type-8.patch
The patch should work exactly the same as the one from #5 and apply properly to newly released 2.0.0-beta1 with composer.
Tested with Drupal core 9.2.9 and read_time-2.0.0-beta1.
Any feedback, comments or suggestions would be greatly appreciated.
Thanks in advance!
Comment #9
Anas_maw CreditAttribution: Anas_maw at Coders Enterprise Web & Mobile Solutions commentedReroll the patch to work on the latest version
Comment #10
Anas_maw CreditAttribution: Anas_maw at Coders Enterprise Web & Mobile Solutions commentedMissed use statements in the previous patch
Comment #11
3liWorks well.