Results

19.05.2022
monster_menus 9.0.x-dev :: src/Routing/RouteSubscriber.php
    $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.05.2022
monster_menus 9.0.x-dev :: src/Routing/OutboundRouteProcessor.php
    $link_url = $route->getPath();
    if (!strncmp($link_url, '/mm/{mm_tree}', 13) && !isset($parameters['mm_tree'])) {
      if (in_array($route_name, ['entity.node.edit_form', 'node.add', 'entity.node.preview']) && ($mmtid = static::getMmtidFromQuery())) {
        $parameters['mm_tree'] = $mmtid;
      }
      else {
        $current_page = mm_active_menu_item();
        $subst = [];
        foreach ($parameters as $name => $value) {
19.05.2022
monster_menus 9.0.x-dev :: modules/mm_webform/mm_webform.module
  switch ($route_name) {
    case 'monster_menus.add_node_with_type':
    case 'node.add':
      if (in_array($route_match->getParameter('node_type'), mm_webform_get_node_types_with_webforms())) {
        return t('Complete as much as you can of the information below, and click on Save. Then you will be able to add elements to your form.');
      }
      return '';

    case 'mm_webform.edit_form':
14.10.2020
muser 8.x-1.x-dev :: modules/custom/muser_project/src/Plugin/Block/MyProjectsHeader.php
      $build['link'] = [
        '#type' => 'link',
        '#url' => Url::fromRoute('node.add', ['node_type' => 'project']),
        '#title' => $this->t('Create project'),
        '#attributes' => ['class' => 'button--standard'],
      ];
    } // In posting period?

    $build['#cache'] = [
14.10.2020
muser 8.x-1.x-dev :: modules/custom/muser_system/src/Plugin/Block/RoundInfo.php
      if ($this->currentUser->hasPermission('create round content')) {
        $manage_url = Url::fromRoute('view.rounds.page_1')->toString();
        $create_url = Url::fromRoute('node.add', ['node_type' => 'round'])->toString();
        $build['my_projects'] = [
          '#theme' => 'status_messages',
          '#message_list' => [
            'warning' => [
              $this->t('There is no <em>current Round</em> set. You may <a href="@manage_url">manage Rounds</a> or <a href="@create_url">create a new Round</a>.', [
                '@manage_url' => $manage_url,
14.10.2020
muser 8.x-1.x-dev :: modules/custom/muser_system/src/Routing/MuserSystemAlterRouteSubscriber.php
      // Do not link to node add form for project_rounds
      if ($name == 'node.add') {
        $route->setRequirement('_muser_system_node_add_access', 'TRUE');
      }

      // Alter form used for delete multiple
      if ($name == 'entity.node.delete_multiple_form' || $name == 'node.multiple_delete_confirm') {
        $route->setDefault('_form', 'Drupal\muser_system\Form\MuserNodeDeleteMultiple');
14.10.2020
muser 8.x-1.x-dev :: modules/custom/muser_system/muser_system.tokens.inc
            $link_text = t('Create a new project');
          }
          $text = Link::createFromRoute($link_text, 'node.add', ['node_type' => 'project'])->toString();
        }
        $replacements[$original] = $text;
      }
    } // Got any 'Add project' tokens with text specified?

    if ($period_text_tokens = \Drupal::token()->findWithPrefix($tokens, 'current-period')) {
          $round_nid = (!empty($muser_data['round'])) ? $muser_data['round']->id() : muser_project_get_current_round();
          if ($round_nid && muser_project_round_in_period($round_nid, 'posting')) {
            $text = Link::createFromRoute(t('Create a new project'), 'node.add', ['node_type' => 'project'])->toString();
          }
          $replacements[$original] = $text;
          break;

        case 'project-contacts':
          $contacts = [];
14.10.2020
muser 8.x-1.x-dev :: modules/custom/muser_system/muser_system.install
  if (empty($round)) {
    $manage_url = Url::fromRoute('view.rounds.page_1')->toString();
    $create_url = Url::fromRoute('node.add', ['node_type' => 'round'])->toString();
    $requirements = [
      'title' => t('Muser current round'),
      'value' => t('Not set'),
      'severity' => REQUIREMENT_WARNING,
      'description' => t('There is no current Round set. You may <a href="@manage_url">manage Rounds</a> or <a href="@create_url">create a new Round</a>.<br/>Last checked: %checked. <a href="@check_url">Check current round now</a>', [
        '@manage_url' => $manage_url,
19.08.2024
navigation_extra 1.0.x-dev :: src/Plugin/Navigation/Extra/ContentPlugin.php
      'navigation.content',
      'node.add_page',
      'node.add',
      'node_type',
      $links
    );

    // $this->createItemRecentContentLinks('node');
  }
06.03.2025
navigation_plus 1.0.5 :: src/EventSubscriber/ShouldNotEditMode.php
  private array $ignoredRoutes = [
    'node.add',
    'entity.node.edit_form',
    'search.view_node_search',
  ];

  public function __construct(
    private readonly RequestStack $requestStack,
05.10.2020
new_relic_rpm 8.x-1.x-dev :: src/EventSubscriber/RoutingTransactionNameSubscriber.php
    if ($route = $collection->get('node.add')) {
      $route->setDefault('_transaction_name_callback', [
        self::class,
        'nodeAddTransactionName',
      ]);
    }
  }
05.10.2020
new_relic_rpm 8.x-1.x-dev :: tests/src/Unit/EventListener/RoutingTransactionNameSubscriberTest.php
  public function testSetsTransactionCallbackOnDynamicRoutes() {
    $collection = new RouteCollection();
    $collection->add('node.add', new Route('/node/add'));
    $event = new RouteBuildEvent($collection);
    $subscriber = new RoutingTransactionNameSubscriber();
    $subscriber->addTransactionNamesToRoutes($event);

    $actualName = $collection->get('node.add')->getDefault('_transaction_name');
    $actualCallback = $collection->get('node.add')->getDefault('_transaction_name_callback');
    $this->assertEquals('node.add', $actualName);
    $this->assertTrue(is_callable($actualCallback));
  }

  /**
   * @covers ::entityBundleRouteTransactionName
   */
    $node_type->id()->willReturn('bar');
    $attributes = [
      '_transaction_name' => 'node.add',
      'node_type' => $node_type->reveal(),
    ];
    $request = new Request([], [], $attributes);
    $actualName = RoutingTransactionNameSubscriber::nodeAddTransactionName($request);
    $this->assertEquals('node.add:bar', $actualName);
  }
04.02.2023
node_add_copy 1.0.0-beta4 :: node_add_copy.module
 */
function node_add_copy_form_alter(&$form, $form_state, $form_id) {
  if (\Drupal::routeMatch()->getRouteName() === 'node.add' && empty($form_state->getUserInput())) {
    $nid = \Drupal::request()->query->get('copy');
    if (!$nid) {
      return;
    }    
    $isWorkflowEdit = str_contains($form_id, $nid);
    $isEdit = str_contains($form_id, 'edit');
31.01.2022
node_singles 3.0.2 :: node_singles.module
    if (
      isset($link['route_name'])
      && $link['route_name'] === 'node.add'
      && isset($singles[$link['route_parameters']['node_type']])
    ) {
      unset($links[$name]);
    }

    // Change the label of the menu links.
07.05.2020
onlyone 8.x-1.x-dev :: src/Controller/OnlyOneController.php
    if (count($content) == 1) {
      $type = array_shift($content);
      return $this->redirect('node.add', ['node_type' => $type->id()]);
    }

    $build['#content'] = $content;

    return $build;
  }
07.05.2020
onlyone 8.x-1.x-dev :: modules/onlyone_admin_toolbar/onlyone_admin_toolbar.module
      // Adding the link to 'Add content (Only One)
      $links['onlyone.add.' . $content_type] = [
        'route_name' => 'node.add',
        'route_parameters' => [
          'node_type' => $content_type,
        ],
        'parent' => 'onlyone.add_page',
      ];
16.10.2020
page_title_visibility 8.x-1.x-dev :: tests/src/Functional/EntityTest.php
  public function testNodeForm() {
    $title = $this->randomString();
    $this->drupalGet(Url::fromRoute('node.add', ['node_type' => 'test']));
    $this->assertSession()->fieldValueEquals('display_page_title[value]', '1');
    $this->getSession()->getPage()->fillField('title[0][value]', $title);
    $this->getSession()->getPage()->findButton('Save')->submit();
    $node = $this->getNodeByTitle($title);
    $this->assertEquals("1", $node->display_page_title->value);
    $title = $this->randomString();
    $this->drupalGet(Url::fromRoute('node.add', ['node_type' => 'test']));
    $this->getSession()->getPage()->fillField('title[0][value]', $title);
    $this->getSession()->getPage()->uncheckField('display_page_title[value]');
    $this->getSession()->getPage()->findButton('Save')->submit();
    $node = $this->getNodeByTitle($title);
    $this->assertEquals("0", $node->display_page_title->value);
  }
03.08.2020
paragraphs_sets 8.x-2.x-dev :: tests/src/Functional/ParagraphSetBasicFunctionality.php
    // Load the node/add page.
    $this->drupalLogin($account);
    $this->drupalGet(Url::fromRoute('node.add', [
      'node_type' => $this->sutNodeType,
    ])->toString());
    $this->assertSession()->statusCodeEquals(200);
    $page = $this->getSession()->getPage();

    // Check that the paragraphs sets controls are present.
11.12.2020
paragraphs_tabs_widget 1.0.0 :: tests/src/Functional/VerticalTabWidgetHtmlOutputTest.php
    // Log in as the user, and load the node/add page for the content type.
    $this->drupalLogin($this->sutAdminUser);
    $this->drupalGet(Url::fromRoute('node.add', ['node_type' => $this->sutNodeType->id()])->toString());
    $this->assertSession()->statusCodeEquals(200);
    $page = $this->getSession()->getPage();

    // Assert the widget appears and has the correct HTML structure.
    $page->hasField($this->sutParagraphNodeFieldName);
11.12.2020
paragraphs_tabs_widget 1.0.0 :: tests/src/FunctionalJavascript/VerticalTabWidgetJsTest.php
    // verifying we can find an add more button is inside the vertical tabs menu
    // list.
    $this->drupalGet(Url::fromRoute('node.add', ['node_type' => $this->sutNodeType->id()])->toString());
    $page = $this->getSession()->getPage();
    $vtAddButton = $page->findAll('xpath', $this->assertSession()->buildXPathQuery('//*[contains(@class,:jsVtWrapperClass)]/*[contains(@class,:vtWrapperClass)]/ul[contains(@class,:vtMenuClass)]/*[@data-paragraphs-tabs-widget-addmore-group=:fieldName]', [
      ':jsVtWrapperClass' => 'js-form-type-vertical-tabs',
      ':vtWrapperClass' => 'vertical-tabs',
      ':vtMenuClass' => 'vertical-tabs__menu',
      ':vtMenuItemClass' => 'vertical-tabs__menu-item',
    // Verify vertical tabs JS transforms a node/add page (i.e.: empty values).
    $this->drupalGet(Url::fromRoute('node.add', ['node_type' => $this->sutNodeType->id()])->toString());
    $page = $this->getSession()->getPage();

    // Node/add: Find evidence that JavaScript ran on the page by looking for a
    // class not sent in the initial page response.
    $fieldLabel = $page->findAll('xpath', $this->assertSession()->buildXPathQuery('//*[@data-paragraphs-tabs-widget-group-wrapper=:nodeFieldMachName]//*[contains(@class,:jsVtWrapperClass)]/label[text()=:fieldLabelText]', [
      ':nodeFieldMachName' => $this->sutParagraphNodeFieldName,
    // Verify summaries on a node/add page (i.e.: empty values).
    $this->drupalGet(Url::fromRoute('node.add', ['node_type' => $this->sutNodeType->id()])->toString());
    $page = $this->getSession()->getPage();

    // Node/add: Find the tab summaries. On a node/add page, there should only
    // be one, with an empty summary-controlling field, and therefore, an empty
    // tab summary.
    $vtMenuItemSummariesBefore = $page->findAll('xpath', $xpathQueryMenuItemSummary);
    // Go to a node/add page.
    $this->drupalGet(Url::fromRoute('node.add', ['node_type' => $this->sutNodeType->id()])->toString());
    $page = $this->getSession()->getPage();

    // Verify there is initially 1 vertical tab pane.
    $verticalTabsPanesPageLoad = $page->findAll('xpath', $xpathQueryVtPanes);
    $this->assertCount(1, $verticalTabsPanesPageLoad, 'There is initially 1 vertical tab pane on the node/add page.');

Pages

Главная | Обратная связь

drupal hosting | друпал хостинг | it patrol .inc