Skip to content
Snippets Groups Projects

3421753: fix error on new node creation

1 unresolved thread
1 file
+ 6
2
Compare changes
  • Side-by-side
  • Inline
@@ -135,12 +135,16 @@ class AutoReferenceApplyForm extends FormBase {
}
// No sense in submit button for auto-apply case.
if (!$auto_apply) {
// Check if node id exists (in case we add a new node)
if (!$auto_apply && $node->id()) {
    • Hmmm I wonder how we hit here in the first place? I guess my concern here is then:

      1. User creates a new node and wants to get tag suggestions
      2. Node does not yet have an ID, so user no longer sees a 'Save selections' submit button, user is not able to apply suggested tags

      Is this the case now with this change?

      • I assume that when a user attempts to get tag suggestions, this first saves the node (the module's custom button is submitting the node form); hence, a node ID will be available on the next step.

        Edited by Andrea Kostakis
      • If my assumption is wrong (re-save and then generate), the patch fixes the issue but makes the "Generate references with AI" unusable on node creation. If that's the case, I think that even without the patch, this is a broader issue, as this probably breaks the new node form? The submission form likely does not let the user save a new node in general.

        Edited by Andrea Kostakis
      • Please register or sign in to reply
Please register or sign in to reply
$form['submit'] = [
'#type' => 'submit',
'#value' => $this->t('Save selections'),
'#weight' => 50,
'#suffix' => Link::fromTextAndUrl($this->t('Reject all suggestions'), $node->toUrl('edit-form'))->toString(),
'#suffix' => Link::fromTextAndUrl(
$this->t('Reject all suggestions'),
$node->toUrl('edit-form', ['nid' => $node->id()])
)->toString(),
];
}
Loading