Results
10.06.2024
gin_type_tray 1.0.x-dev ::
src/Routing/GinTypeTrayRouteSubscriber.php
// Modify the "/node/add" route to use our own controller instead.
if ($route = $collection->get('node.add_page')) {
$defaults = $route->getDefaults();
$defaults['_controller'] = "\Drupal\gin_type_tray\Controller\GinTypeTrayController::addPage";
$route->setDefaults($defaults);
}
} 10.06.2024
gin_type_tray 1.0.x-dev ::
gin_type_tray.module
$theme_registry['type_tray_page']['template'] = 'type-tray-page';
$theme_registry['type_tray_page']['path'] = \Drupal::service('extension.list.module')->getPath('gin_type_tray') . '/templates';
$theme_registry['type_tray_page']['variables']['node_add_page_url_grid'] = Url::fromRoute('node.add_page', ['layout' => 'grid']);
$theme_registry['type_tray_page']['variables']['node_add_page_url_list'] = Url::fromRoute('node.add_page', ['layout' => 'list']);
}
}
/*
* Implements hook_preprocess(). 27.01.2023
live_blog 1.0.4 ::
live_blog.module
$output .= '<li>' . t('Go to the "Manage display" page and disable "Label" for this New field.') . '</li>';
$output .= '<li>' . t('Create content from step 2) by <a href=":new_content">link</a>', [
':new_content' => Url::fromRoute('node.add_page')->toString()
]) . '</li>';
$output .= '<li>' . t('Enable the "Live Blog status" checkbox and Save.') . '</li>';
$output .= '<li>' . t('Now you can add/update/delete any posts.') . '</li>';
$output .= '</ol>';
$output .= '<p>' . t('Multiple users can have that page opened and all Live Blog posts get updated automatically.') . '</p>';
$output .= '<p>' . t('Thank you for using it!') . '</p>'; 13.11.2025
livre 1.0.0-beta6 ::
book/help_topics/book.adding.html.twig
---
{% set node_add_link_text %}{% trans %}Add content{% endtrans %}{% endset %}
{% set node_add_link = render_var(help_route_link(node_add_link_text, 'node.add_page')) %}
{% set configuring_topic = render_var(help_topic_link('book.configuring')) %}
<h2>{% trans %}Goal{% endtrans %}</h2>
<p>{% trans %}Add a page to an existing book.{% endtrans %}</p>
<h2>{% trans %}Steps{% endtrans %}</h2>
<ol>
<li>{% trans %}In the <em>Manage</em> administrative menu, navigate to <em>Content</em> > <em>{{ node_add_link }}</em> > <em>Book page</em>. If you have configured additional content types that can be added to books, you can substitute a different content type for <em>Book page</em>; see {{ configuring_topic }} for more information.{% endtrans %}</li> 22.06.2020
menu_link_weight 8.x-1.x-dev ::
tests/src/Functional/MenuLinkWeightNodeTest.php
// Assert that the reordering was successful.
$this->assertLinkWeight('node.add_page', -50);
$this->assertLinkWeight($link1_id, -49);
$this->assertLinkWeight('filter.tips_all', -48);
$this->drupalGet($node1_edit_url);
$this->assertSession()->pageTextContains('(provided menu link)');
$this->assertSession()->pageTextContains('Change the weight of the links within the Tools menu');
$this->assertLinkWeight('filter.tips_all', -49);
$this->assertLinkWeight($link2_id, -48);
$this->assertLinkWeight('node.add_page', -47);
$node2_edit_url = $this->drupalGetNodeByTitle($node2_title)->toUrl('edit-form');
$this->drupalGet($node2_edit_url);
$this->assertSession()->pageTextContains('(provided menu link)');
$option = $this->assertSession()->optionExists('edit-menu-menu-link-weight-link-current-weight', -48);
$this->assertLinkWeight('filter.tips_all', -48);
$this->assertLinkWeight($link2_id, -47);
$this->assertLinkWeight('node.add_page', -46);
// Test the custom tree reordering functionality:
$this->moduleInstaller->install(array('menu_link_weight_test'));
// Insert the new link above item 2:
$this->state->set('menu_link_weight_test_parent_value', 'tools:');
$this->state->set('menu_link_weight_test_relative_position', 'above_' . $link2_id);
$this->assertLinkWeight($link4_id, -47);
$this->assertLinkWeight($link2_id, -46);
$this->assertLinkWeight('node.add_page', -45);
$this->state->set('menu_link_weight_test_relative_position', 'below_' . $link2_id);
$node5_title = $this->randomMachineName();
$edit = array(
'title[0][value]' => $node5_title,
'menu[enabled]' => 1,
$this->assertLinkWeight($link2_id, -46);
$this->assertLinkWeight($link5_id, -45);
$this->assertLinkWeight('node.add_page', -44);
}
} 22.06.2020
menu_link_weight 8.x-1.x-dev ::
tests/src/Functional/MenuLinkWeightMenuUiTest.php
// Assert that the reordering was successful.
$this->assertLinkWeight('node.add_page', -50);
$this->assertLinkWeight($link1_id, -49);
$this->assertLinkWeight('filter.tips_all', -48);
$this->drupalGet($node1_link->getEditRoute());
$this->assertSession()->elementContains('css', '.menu-link-weight-link-current', $node1_title);
$this->assertSession()->pageTextContains('(provided menu link)');
$this->assertLinkWeight('filter.tips_all', -49);
$this->assertLinkWeight($link2_id, -48);
$this->assertLinkWeight('node.add_page', -47);
$this->drupalGet($node2_link->getEditRoute());
$this->assertSession()->elementContains('css', '.menu-link-weight-link-current', $node2_title);
$this->assertSession()->pageTextContains('(provided menu link)');
$option = $this->assertSession()->optionExists('edit-menu-menu-link-weight-link-current-weight', -48);
$this->assertTrue($option->hasAttribute('selected'));
$this->assertLinkWeight('filter.tips_all', -48);
$this->assertLinkWeight($link2_id, -47);
$this->assertLinkWeight('node.add_page', -46);
// Test the custom tree reordering functionality:
$this->moduleInstaller->install(array('menu_link_weight_test'));
// Insert the new link above item 2:
$this->state->set('menu_link_weight_test_parent_value', 'tools:');
$this->state->set('menu_link_weight_test_relative_position', 'above_' . $link2_id);
$this->assertLinkWeight($link4_id, -47);
$this->assertLinkWeight($link2_id, -46);
$this->assertLinkWeight('node.add_page', -45);
$this->state->set('menu_link_weight_test_relative_position', 'below_' . $link2_id);
$node5_title = '5 ' . $this->randomMachineName();
$node5 = $this->drupalCreateNode(['type' => $this->nodeType, 'title' => $node5_title]);
$edit = array(
'title[0][value]' => $node5_title,
$this->assertLinkWeight($link2_id, -46);
$this->assertLinkWeight($link5_id, -45);
$this->assertLinkWeight('node.add_page', -44);
// Rearrange menu link on a default menu link form.
$edit = array(
'menu[menu_link_weight][' . $link1_id . '][weight]' => '1',
'menu[menu_link_weight][' . $link2_id . '][weight]' => '2',
'menu[menu_link_weight][' . $link3_id . '][weight]' => '3',
$this->assertLinkWeight($link5_id, 5);
$this->assertLinkWeight('filter.tips_all', 6);
$this->assertLinkWeight('node.add_page', 7);
}
} 02.02.2023
mercury_editor 2.0.x-dev ::
src/Entity/MercuryEditorEntityFormTrait.php
else {
$element['#value'] = Url::fromRoute('node.add_page', [], ['absolute' => TRUE])->toString();
}
return $element;
}
/** 07.02.2022
micronode 1.0.0 ::
src/Routing/MicronodeRouteSubscriber.php
if (!$this->moduleHandler->moduleExists('type_tray')) {
// Modify the "/node/add" route to use our own controller instead.
if ($route = $collection->get('node.add_page')) {
$defaults = $route->getDefaults();
$defaults['_controller'] = '\Drupal\micronode\Controller\MicronodeController::addPage';
$route->setDefaults($defaults);
}
} 19.05.2022
monster_menus 9.0.x-dev ::
src/Routing/RouteSubscriber.php
// Modify some built-in routes to point to MM's equivalent.
$aliases = [
'node.add_page' => 'monster_menus.add_node',
'node.add' => 'monster_menus.add_node_with_type',
];
foreach ($aliases as $from => $to) {
if ($collection->get($from) && ($to_route = $collection->get($to))) {
$collection->remove($from);
$collection->add($from, clone $to_route); 19.08.2024
navigation_extra 1.0.x-dev ::
src/Plugin/Navigation/Extra/ContentPlugin.php
$this->addCreateEntityLinks(
'navigation.content',
'node.add_page',
'node.add',
'node_type',
$links
);
// $this->createItemRecentContentLinks('node'); 09.08.2020
og 8.x-1.x-dev ::
tests/src/Kernel/Entity/EntityCreateAccessTest.php
// Verify that the user does not have access to the entity create form of
// the group content type.
$url = Url::fromRoute('node.add_page');
$this->assertNotInstanceOf(AccessResultAllowed::class, $url->access(User::getAnonymousUser(), TRUE));
// Test that the user can access the entity create form when the permission
// to create group content is granted. Note that node access control is
// cached, so we need to reset it when we change permissions.
$this->container->get('entity_type.manager')->getAccessControlHandler('node')->resetCache(); 07.05.2020
onlyone 8.x-1.x-dev ::
onlyone.module
':content' => Url::fromRoute('system.admin_content')->toString(),
'@onlyone_add_page' => $onlyone_add_page,
':add-content' => Url::fromRoute('node.add_page')->toString(),
];
// Getting the help link for the admin_toolbar module.
$admin_toolbar_page = \Drupal::service('onlyone.module_handler')->getModuleHelpPageLink('admin_toolbar', 'Admin Toolbar', TRUE);
// Getting the help link for the admin_toolbar_tools module.
$admin_toolbar_tools_page = \Drupal::service('onlyone.module_handler')->getModuleHelpPageLink('admin_toolbar_tools', 'Admin Toolbar Extra Tools', TRUE);
$output .= '<dd>' . t('To configure the module settings visit the <a href=":settings-page">Settings</a> page, if you want to have the configured content types in a new menu entry named <em>Add content (Only One)</em> you must check the option <em>Show configured content types in a new menu entry</em>, the new menu link will be available in the <a href=":content">Content</a> page as an action link to the @onlyone_add_page, then the <a href=":add-content">Add content</a> page will show the not configured content types. For this you need the <em>Administer Only One</em> permission.', $routes) . '</dd>';
$output .= '<dt>' . t('Creating content') . '</dt>';
$output .= '<dd>' . t('Once you try to <a href=":add-content">Add content</a>, if the chosen content type is configured to have Only One content and it already has one content created in the actual language, you will be redirected to <em>edit</em> the content, otherwise, you will go to create a new one.', [':add-content' => Url::fromRoute('node.add_page')->toString()]) . '</dd>';
$output .= '</dl>';
$output .= '<h3>' . t('Aditionals modules') . '</h3>';
$output .= '<dl>';
$output .= '<dt>' . $onlyone_admin_toolbar . '</dt>';
$output .= '<dd>' . t(
'Very useful if you use the @admin_toolbar_page module as it handles modifications to the @admin_toolbar_tools_page module menu entries related to the configured content types.', 20.01.2023
openchurch_theme 3.0.0-alpha3 ::
templates/includes/get-started.html.twig
{% set drupal_values = 'https://www.drupal.org/about/values-and-principles' %}
{% set drupal_user_guide = 'https://www.drupal.org/docs/user_guide/en/index.html' %}
{% set create_content = path('node.add_page') %}
{% set drupal_extend = 'https://www.drupal.org/docs/extending-drupal' %}
{% set drupal_global_training_days = 'https://groups.drupal.org/global-training-days' %}
{% set drupal_events = 'https://www.drupal.org/community/events' %}
{% set drupal_slack = 'https://www.drupal.org/slack' %}
{% set drupal_chat = 'https://www.drupal.org/drupalchat' %}
{% set drupal_answers = 'https://drupal.stackexchange.com/' %} 21.10.2020
rabbit_hole 8.x-1.x-dev ::
modules/rh_node/tests/src/Functional/NodeBehaviorSettingsFormTest.php
*/
protected function getCreateEntityUrl() {
return Url::fromRoute('node.add_page');
}
/**
* {@inheritdoc}
*/
protected function getEditEntityUrl($id) { 11.03.2021
route_ui 1.0.0-alpha2 ::
tests/src/Functional/CustomActionLinksTest.php
// Assert a couple of route names are present. A full test would require
// a WebDriverTestBase test.
$assert->responseContains('node.add_page');
$assert->responseContains('node.configure_rebuild_confirm');
}
} 19.10.2020
simplenews 3.0.0-alpha1 ::
src/Plugin/Derivative/AddSimplenewsIssueActionLinks.php
elseif (count($node_types) > 1) {
$base_plugin_definition['route_name'] = 'node.add_page';
$base_plugin_definition['title'] = new TranslatableMarkup('Add content');
$this->derivatives[] = $base_plugin_definition;
}
return parent::getDerivativeDefinitions($base_plugin_definition);
} 10.06.2020
social_course 8.x-2.11 ::
src/Routing/RouteSubscriber.php
if ($route = $collection->get('node.add_page')) {
$route->setDefault('_controller', '\Drupal\social_course\Controller\NodeController::addPage');
}
parent::alterRoutes($collection);
$paths = [ 05.03.2020
total_control 8.x-2.0 ::
src/Plugin/Block/ContentOverview.php
$markup_data = $this->t('No content available.') . ' '
. Link::fromTextAndUrl($this->t('Add content'),
new Url('node.add_page'))->toString();
return [
'#type' => 'markup',
'#markup' => $markup_data,
];
} 14.03.2021
type_tray 1.0.x-dev ::
src/Routing/TypeTrayRouteSubscriber.php
protected function alterRoutes(RouteCollection $collection) {
// Modify the "/node/add" route to use our own controller instead.
if ($route = $collection->get('node.add_page')) {
$defaults = $route->getDefaults();
$defaults['_controller'] = '\Drupal\type_tray\Controller\TypeTrayController::addPage';
$route->setDefaults($defaults);
}
} 14.03.2021
type_tray 1.0.x-dev ::
src/Controller/TypeTrayController.php
// Send the user back to the Type Tray page.
return new RedirectResponse(Url::fromRoute('node.add_page')->setAbsolute()->toString());
}
} 