I might be missing something but in entity_embed/src/Form/EntityEmbedDialog.php on line 763 there's the possibility to hook into the submitEmbedStep function:
// Allow other modules to alter the values before getting submitted to the WYSIWYG.
$this->moduleHandler->alter('entity_embed_values', $values, $entity, $display, $form_state);
This works but the alter function only accepts and uses 2 context variables:
public function alter($type, &$data, &$context1 = NULL, &$context2 = NULL);
So the $form_state variable is never passed to the altering modules, right? Is this intentional?
| Comment | File | Size | Author |
|---|---|---|---|
| #7 | 2907616-7.patch | 745 bytes | wim leers |
Comments
Comment #2
sanderjp commentedComment #3
sanderjp commentedComment #4
wim leersI'm shocked this API even exists … it's not documented in
entity_embed.api.php. This seems like a very bad idea IMHO…Comment #5
marcoscanoNot the same hook, but sort of related: #2593315: Improve documentation of hook_entity_embed_alter()
Comment #6
wim leersYep, both are docs bugs. Also, I think I overestimated the priority of this, degrading :)
Comment #7
wim leersI'm wondering if we can't just remove this API? OTOH, it's already in there, so … better not break this.
#2688427: Rich HTML Captions added this. Specifically, https://github.com/drupal-media/entity_embed/pull/212/commits/c1ea27f98c.... Without any discussion/reasoning in https://github.com/drupal-media/entity_embed/pull/212. So that makes it difficult to figure out whether we can remove this.
Granting access to
$form_stateon top of what's already being provided to alter hooks would make this even more complex. So, given that only a single person ever noticed this, and nobody can be relying on$form_state, I'm just gonna go ahead and remove$form_state. It's effectively a dead parameter.Comment #8
wim leersComment #10
wim leers