- First commit to issue fork.
- Assigned to asirjacques
- ๐ฎ๐ชIreland asirjacques Dublin
I spent quite some times trying to figure out what could be the issue but so far the workaround is the best option.
One thing I've noticed is that once the node has already been saved it works without issue.
The renderPlain() funtion inside estimated_read_time_entity_presave() is where the error gets triggered.
So far I am thinking 2 options:
1 - We could use estimated_read_time_entity_insert and estimated_read_time_entity_update instead.
2 - We could get the value from the textfields directly and get rid of the call to the renderPlain funtion. The same way that it is done in the node_read_time module.
I think 2 is the better option.
- ๐บ๐ธUnited States mtalt Maryland
@asirjacques Thanks for taking a look. The error is occurring for new nodes on this line of the renderLinks method of NodeViewBuilder. The issue is that since the node has not been saved, it does not have an ID, so $node_entity_id will be NULL.
Using estimated_read_time_entity_insert does seem to work, but estimated_read_time_entity_update is going to throw this error if revisions are on.
Perhaps we could check if the entity is new and use estimated_read_time_entity_insert, but continue to use estimated_read_time_entity_presave if it is an update.
We could get the value from the textfields directly and get rid of the call to the renderPlain funtion. The same way that it is done in the node_read_time module.
One of the reasons I made this module was because the other estimated read time solutions did not work well with layout builder. Only using fields on the entity will leave out any inline blocks that could meaningfully contribute to the read time. There are also some cases where content could be pulled in dynamically through a view or some other method. In those cases, the content dynamically pulled in would be left out of the read time. I'm wary of moving to that solution if it will not work with layout builder.
- ๐ฎ๐ณIndia shabana.navas
shabana.navas โ made their first commit to this issueโs fork.
- @shabananavas opened merge request.
- @shabananavas opened merge request.
- Status changed to Needs review
over 1 year ago 7:32pm 16 February 2023 - ๐ฎ๐ณIndia shabana.navas
Added changes to this MR: https://git.drupalcode.org/project/estimated_read_time/-/merge_requests/...
- ๐ฎ๐ณIndia shabana.navas
Btw, for some reason adding the estimated read time field via Layout Builder does NOT currently work on our site. The spinner just spins and stops without adding the field to a block section. There are no errors reported. I did a workaround by creating a custom block and rendering the field via the block.
- ๐จ๐ฆCanada SamirMtl
HI
found a new issue described here: https://www.drupal.org/project/estimated_read_time/issues/3345620 ๐ Error on adding new translation Fixed -
mtalt โ
committed f8b329ce on 1.0.x authored by
shabana.navas โ
Issue #3322934 by shabana.navas, SamirMtl, asirjacques, FiNeX, mtalt:...
-
mtalt โ
committed f8b329ce on 1.0.x authored by
shabana.navas โ
- Status changed to Fixed
over 1 year ago 7:33pm 17 March 2023 - ๐บ๐ธUnited States mtalt Maryland
Thanks all! I have tested and merged MR 10 from comment #8.
- ๐บ๐ธUnited States mtalt Maryland
@SamirMtl, I'll take a look at your issue with translations separately. I didn't want to combine the two issues into one.
- ๐บ๐ธUnited States mtalt Maryland
@shabana.navas
Btw, for some reason adding the estimated read time field via Layout Builder does NOT currently work on our site. The spinner just spins and stops without adding the field to a block section. There are no errors reported. I did a workaround by creating a custom block and rendering the field via the block.
This has been fixed in https://www.drupal.org/project/estimated_read_time/issues/3349101 ๐ Cannot add or modify read time field through layout builder Fixed
Automatically closed - issue fixed for 2 weeks with no activity.