function addanother_node_form_message_submit in Add Another 8
Same name and namespace in other branches
- 7.2 addanother.module \addanother_node_form_message_submit()
Submit handler if the normal submit button was pressed.
1 string reference to 'addanother_node_form_message_submit'
- addanother_form_node_form_alter in ./
addanother.module - Implements hook_form_BASE_FORM_ID_form_alter().
File
- ./
addanother.module, line 143 - Allows users to Add Another node of the same type easily.
Code
function addanother_node_form_message_submit($form, FormStateInterface &$form_state) {
/* @var \Drupal\node\NodeInterface $node */
if ($node = $form_state
->getFormObject()
->getEntity()) {
_addanother_quelch_message($node);
$type_url = Url::fromRoute('node.add', [
'node_type' => $node
->getType(),
]);
$t_args = [
'@type' => node_get_type_label($node),
':type_url' => $type_url
->toString(),
];
\Drupal::messenger()
->addMessage(t('You may <a href=":type_url">add another @type</a>.', $t_args));
}
}