Results
30.03.2020
form_mode_manager 8.x-1.x-dev ::
tests/src/Kernel/FormModeManagerRouteTest.php
public static function providerEntityRouteInfos() {
$data = [];
$data[] = ['node', 'add_form', 'node.add'];
$data[] = ['node', 'edit_form', 'entity.node.edit_form'];
$data[] = ['user', 'add_form', 'user.register'];
$data[] = ['user', 'edit_form', 'entity.user.edit_form'];
$data[] = ['user', 'admin_add', 'user.admin_create'];
$data[] = ['block_content', 'add_form', 'block_content.add_form'];
$data[] = ['block_content', 'edit_form', 'entity.block_content.edit_form']; 04.04.2022
forum 1.x-dev ::
src/Controller/ForumController.php
'@node_type' => $this->nodeTypeStorage->load($type)->label(),
]),
'url' => Url::fromRoute('node.add', ['node_type' => $type]),
],
'#cache' => [
'tags' => $node_type->getCacheTags(),
],
];
if ($forum_term && $forum_term->bundle() == $vid) { 04.04.2022
forum 1.x-dev ::
forum.module
$output .= '<dt>' . t('Starting a discussion') . '</dt>';
$output .= '<dd>' . t('The <a href=":create-topic">Forum topic</a> link on the <a href=":content-add">Add content</a> page creates the first post of a new threaded discussion, or thread.', [
':create-topic' => Url::fromRoute('node.add', ['node_type' => 'forum'])
->toString(),
':content-add' => Url::fromRoute('node.add_page')->toString(),
]) . '</dd>';
$output .= '<dt>' . t('Navigating in the forum') . '</dt>';
$output .= '<dd>' . t('Installing the Forum module provides a default <em>Forums</em> menu link in the Tools menu that links to the <a href=":forums">Forums page</a>.', [':forums' => Url::fromRoute('forum.index')->toString()]) . '</dd>';
$output .= '<dt>' . t('Moving forum topics') . '</dt>'; 28.09.2019
forum_access 8.x-1.0-alpha2 ::
forum_access.module
return forum_access_access('create', $term->id()) ? AccessResult::allowed() : AccessResult::forbidden();
case 'node.add':
$forum_id = \Drupal::request()->get('forum_id');
return forum_access_access('create', $forum_id) ? AccessResult::allowed() : AccessResult::forbidden();
}
return AccessResult::neutral();
} 10.10.2020
freelinking 8.x-3.x-dev ::
modules/freelinking_prepopulate/src/Plugin/freelinking/FreelinkingPrepopulate.php
$this->moduleHandler->alter('freelinking_prepopulate_query', $options['query'], $target);
$url = Url::fromRoute('node.add', $route_params, $options);
if ($url->access()) {
$link = [
'#type' => 'link',
'#title' => $title,
'#url' => $url, 17.07.2020
fullcalendar 8.x-2.x-dev ::
src/Plugin/views/style/FullCalendar.php
// Can the user add a new event?
if ($settings['entityType'] === 'node') {
if ($this->accessManager->checkNamedRoute('node.add', ['node_type' => $settings['bundle_type']])) {
$settings['addLink'] = 'node/add/' . $settings['bundle_type'];
}
}
else {
$entity_type = $this->view->getBaseEntityType();
$entity_links = $entity_type->get('links'); 24.01.2021
g2 8.x-1.x-dev ::
src/Controller/Homonyms.php
];
$offer = $this->t('Would you like to <a href=":url" title="Create new entry for @entry">create one</a> ?', [
':url' => Url::fromRoute('node.add', $arguments, $options)->toString(),
'@entry' => $raw_match,
]);
}
else {
$offer = NULL;
} 10.10.2022
gantt 1.0.8 ::
Demo/gantt_node/config/install/views.view.gantt.yml
plugin_id: text_custom
empty: true
content: "<a href=\"{{ path('node.add', {'node_type' : 'gantt'}) }}?destination=gantt\" class=\"btn btn-success\"><i class=\"bi bi-calendar-plus\"></i> {{ 'Add task'|t }}</a>"
tokenize: true
footer: { }
display_extenders: { }
cache_metadata:
max-age: -1
contexts: 08.03.2021
gin_gutenberg 1.0.x-dev ::
gin_gutenberg.module
// Handle both node edit and node add scenarios.
if (in_array($route_name, ['entity.node.edit_form', 'node.add'])) {
if ($route_name === 'entity.node.edit_form') {
$route_entity = $route_match->getParameter('node');
}
elseif ($route_name === 'node.add') {
$node_type = $route_match->getParameter('node_type');
if ($node_type instanceof NodeType) {
$route_entity = Node::create(['type' => $node_type->id()]);
}
}
// Routes to include.
$route_names = [
'node.add',
'entity.node.content_translation_add',
'quick_node_clone.node.quick_clone',
'entity.node.edit_form',
];
if ( 24.08.2022
gin_lp 1.0.x-dev ::
gin_lp.module
if (in_array($route_name, [
'entity.node.edit_form',
'node.add',
'entity.node.content_translation_add',
'layout_paragraphs.builder.edit_item',
'layout_paragraphs.builder.insert',
'layout_paragraphs.builder.choose_component',
'layout_paragraphs.builder.delete_item']) //preg_match('/^(edit\.([^.]+\.)?)/', $route_name)
) { 28.08.2020
gin_toolbar 8.x-1.x-dev ::
src/Menu/GinToolbarActiveTrail.php
// Create Content.
if ($route_name === 'node.add') {
$link = $this->getLinkByRoutes($menu_name, [
[$route_name, $route_params],
['node.add_page', []],
['system.admin_content', []],
]);
} 16.12.2024
headless_cms 1.0.3 ::
modules/headless_cms_preview/headless_cms_preview.module
$entity = $formObj->getEntity();
$query_options = ['query' => ['uuid' => $entity->uuid()]];
$toUrl = $entity->isNew() ? Url::fromRoute('node.add', ['node_type' => $entity->bundle()], $query_options) : $entity->toUrl('edit-form', $query_options);
if ($destination = \Drupal::request()->query->get('destination')) {
$toUrl->setRouteParameter("destination", $destination);
}
\Drupal::request()->query->remove('destination'); 14.05.2020
image_widget_crop 8.x-2.x-dev ::
modules/image_widget_crop_examples/src/Controller/FrontPage.php
$items['#items'][] = $this->t('<a href="@url">@label',
[
'@url' => Url::fromRoute('node.add', ['node_type' => $node_type->id()])->toString(),
'@label' => $node_type->label(),
]
);
}
$this->addExample($items); 15.06.2020
imotilux 8.x-1.x-dev ::
imotilux.module
$imotilux_links['imotilux_add_child'] = [
'title' => t('Add child page'),
'url' => Url::fromRoute('node.add', ['node_type' => $child_type], ['query' => ['parent' => $node->id()]]),
];
}
if ($account->hasPermission('access printer-friendly version')) {
$imotilux_links['imotilux_printer'] = [
'title' => t('Printer-friendly version'), 30.05.2023
layout_builder_paragraphs 1.0.x-dev ::
layout_builder_paragraphs.module
$route = \Drupal::routeMatch()->getRouteName();
// Add the Save and edit layout button for node edit form with layout builder.
if ($route === 'node.add' || $route === 'entity.node.edit_form') {
if (!empty($form_state->getStorage()['form_display'])) {
// Check if this bundle allows custom layout builder per node.
$bundle = $form_state->getStorage()['form_display']->getTargetBundle();
$fields = \Drupal::service('entity_field.manager')->getFieldDefinitions('node', $bundle);
if (isset($fields['layout_builder__layout'])) {
$is_edit_form = $form_state->getFormObject()->getOperation() === 'edit'; 13.11.2025
livre 1.0.0-beta6 ::
book/src/Hook/BookAlterHooks.php
$book_links['book_add_child'] = [
'title' => $this->t('Add child page'),
'url' => Url::fromRoute('node.add', ['node_type' => $child_type], ['query' => ['parent' => $node->id()]]),
];
}
if (!empty($book['pid']) && $book_access instanceof AccessResultAllowed) {
$book_links['book_add_sibling'] = [
'title' => $this->t('Add sibling page'),
'url' => Url::fromRoute('node.add', ['node_type' => $child_type], ['query' => ['parent' => $book['pid']]]),
];
}
$print_access = $this->bookPrintAccessCheck->access();
if ($print_access instanceof AccessResultAllowed) {
$book_links['book_printer'] = [
'title' => $this->t('Printer-friendly version'), 01.05.2025
localgov_publications 1.0.14 ::
localgov_publications.module
if (localgov_publications_is_publication_type($node->getType()) && isset($links['book']['#links']['book_add_child'])) {
$links['book']['#links']['book_add_child']['url'] = Url::fromRoute('node.add', ['node_type' => 'localgov_publication_page'], ['query' => ['parent' => $node->id()]]);
}
}
/**
* Implements hook_preprocess_node().
*/ 28.11.2018
material_admin 8.x-1.0-alpha7 ::
templates/node/node-add-list.html.twig
<div class="collection-item row"><h4 class="collection-item-title col s12">{% trans %}Add New Content{% endtrans %}</h4></div>
{% for type_id,type in types %}
<a class="collection-item row" href="{{ path('node.add', {'node_type': type_id }) }}">
<span class="collection-item-title col s12" >{{type.label}}</span> <span class="collection-item-description col s12">{{ type.description }}</span></a>
{% endfor %}
</div>
{% else %}
<p>
{% set create_content = path('node.type_add') %} 15.10.2025
menu_link_content_revisions_ui 1.0.0 ::
tests/src/Functional/MenuLinkContentRevisionsUiLogPageTest.php
// Navigate to mypage node add form.
$newNodeForm = Url::fromRoute('node.add', ['node_type' => 'mypage']);
$this->drupalGet($newNodeForm);
// Assure we loaded the add node form.
$web_assert->statusCodeEquals(200);
// Add a mypage node. 10.05.2020
moderation_dashboard 8.x-1.0-beta2 ::
src/Plugin/Block/ModerationDashboardAddLinks.php
'#type' => 'link',
'#title' => $type->label(),
'#url' => new Url('node.add', ['node_type' => $type->id()]),
];
}
}
return $build;
} 