Debugging the modules seems to show that it fails at
$content = (string) $this->renderer->renderInIsolation($build);
...
Dblog told about an error with quickedit.
The node saved after I uninstalled the Quickedit module :-).
So this should work after fixing it.Hello @mtalt.
Thank you for your tests. I've created a single content type with paragraphs and it works. The trouble seems to come from my website content type or special fields, I have to investigate. So you can close this ticket. I will create another one if I find the real cause of my trouble.
Otherwise, I will process the fields in a preprocess.
Regards.- ๐บ๐ธUnited States mtalt Maryland
@fabrondeau I setup a new content type with a paragraph as you described, but I was unable to replicate. Are you able to determine what part of doEstimate() is causing the error? One idea is that an error is occurring when attempting to render the default view mode. Also, can you check that your $wordsPerMinute is a positive integer?
I browsed the https://ecaguide.org/ page a lot, but I didn't always find a detailed description that would have helped, but it's probably enough for a more experienced Drupal developer. What is required in the configuration form is not always clear. Obviously, you have to get used to it after the Rules module, where the module already provided the values โโto be set in a drop-down list, but in ECA you have to enter them manually and the form of entering tokens and more, it's a bit confusing.
I'll go through the section about Tokens in the description again.
Thank you!- ๐ฉ๐ชGermany jurgenhaas Gottmadingen
The event cron doesn't automatically provide any tokens.
When you use the action "Load entity", you store the loaded entity in a token.
Then, when using the "Set field value" action, you need to use the token name that holds your entity in the entity field.
That's pretty much exactly what the description in the config forms tells as well. And there is a full chapter about tokens in the ECA Guide.
Solved.
So, if it is "Event: Cron", "Action: Entity Load", then "Entity: set field value", then when setting "Action: Entity Load", the following fields cannot be left blank, but the field token must be entered in both: "Name of token" and in the "Entity" field.- ๐บ๐ธUnited States mtalt Maryland
@fabrondeau This module should support your use-case. It calculates the read time based on the words present in a view mode. Can you let me know what the values for $viewMode and $wordsPerMinute are on this line?
- ๐ฉ๐ชGermany jurgenhaas Gottmadingen
In the "Entity: set field value" action you didn't specify for which entity you want to set the field value.
@mtalt,
My aim is to estimate the read time for a node which is built by paragraphs. The main one is the parent of paragraphs of texts.
There is no direct text field in the node. The node is the parent of multiple paragraphs.
So I'm expecting that the field I have created in the node can process all the texts paragraphs it can find in its children to add them. The node would save the total. Maybe it isn't the goal of this module, then you might let me know if another would suit to my case ?
I confirm that I'm using the 1.2 version of estimated_read_time module.To reproduce:
- install the drupal/paragraphs module: composer require drupal
- enable the module: drush en paragraphs
- create a paragraph type "texts"
- In the texts paragraph type, add a field of type formatted long, multiple instances
- save the paragraph type
- create a node type "my_node"
- add a field of type paragraph field_paragraphs, multiple, select the type "texts"
- add a field of type estimated read time field_estimated_read_time, showed in the form and in the display.
- save the node type.
- create a content of type "my_node"
- add texts paragraphs with false texts (lorem ipsum generated by online, example: https://www.faux-texte.com/)
- add a title
- save the nodeResult: the node can't be saved.
Looking at the code, it seems that $estimation can't be processed in the function doEstimate().Please let me know if you can reproduce the case. Thank you by advance.
But I gave Admin 1 permissions at the beginning of the process.
In the original post, I included the model and the SVG image of the model, so you can see that I did it this way and gave permission.https://ecaguide.org/plugins/eca/user/actions/eca_switch_account/
- ๐ฉ๐ชGermany jurgenhaas Gottmadingen
If you run cron on a Drupal site, the PHP process executes in the context of an anonymous user. And those don't have the permission to change entity field, normally. That's why you get an access denied message. You can use the switch user action to escalate privileges of your ECA model.
- Issue created by @tetatu
- ๐บ๐ธUnited States mtalt Maryland
@fabrondeau Can you confirm you are on version 1.2 of the module? Are you able to get the error from the PHP, webserver, or Drupal's logs? If you are unable to get the error, can you provide replication steps on a fresh Drupal install? I'm not aware of any issues with paragraphs, so I would need to be able to replicate a setup that causes the issue.
- Issue created by @fabrondeau