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.

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

fotuzlab created an issue. See original summary.

fotuzlab’s picture

Here is a patch.

fotuzlab’s picture

Status: Active » Needs review
fjgarlin’s picture

Status: Needs review » Needs work

Firstly, 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.

andriansyah’s picture

Status: Needs work » Needs review
FileSize
5.93 KB
1.05 KB

hook uninstall removed and changed into NodeTypeInterface::unsetThirdPartySetting

fjgarlin’s picture

Status: Needs review » Reviewed & tested by the community

Applies cleanly and works as described. Thanks.

Anas_maw’s picture

+1, Patch in #5 works as expected.

DYdave’s picture

Version: 8.x-1.x-dev » 2.x-dev
Assigned: fotuzlab » Unassigned
Status: Reviewed & tested by the community » Needs review
FileSize
7.28 KB

Hi 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!

Anas_maw’s picture

Reroll the patch to work on the latest version

Anas_maw’s picture

FileSize
8.49 KB

Missed use statements in the previous patch

3li’s picture

Status: Needs review » Reviewed & tested by the community

Works well.