Results

18.06.2021
pate 1.0.0 :: src/Plugin/Derivative/ExtraLinks.php
        $links["node.add_blank.{$type}"] = [
          'title' => $this->t('New blank @type', ['@type' => $content_type->label()]),
          'route_name' => 'node.add',
          'route_parameters' => ['node_type' => $type],
          'parent' => "admin_toolbar_tools.extra_links:node.add.{$type}",
          'weight' => $weight,
        ] + $base_plugin_definition;
        // For each template, add a new link, up to the max defined here (or
        // overridden in Drupal state).
18.06.2021
pate 1.0.0 :: src/Controller/PateTemplatesPerTypeController.php
        'tags' => ['node_list:' . $type->id()],
      ],
      '#add_new_url' => Url::fromRoute('node.add', ['node_type' => $type->id()]),
      '#add_new_label' => $this->t('New blank @type', ['@type' => $type->label()]),
      '#templates' => [],
      '#attached' => [
        'library' => ['pate/templates_list'],
      ],
    ];
21.10.2020
photos 6.0.x-dev :: src/Form/PhotosDirectoryImportForm.php
      if (empty($options)) {
        // No albums found for selected user.
        $add_album_link = Link::fromTextAndUrl($this->t('Add new album.'), Url::fromRoute('node.add', ['node_type' => 'photos']))->toString();
        $form['add_album'] = [
          '#markup' => '<div>' . $this->t('No albums found.') . ' ' . $add_album_link . '</div>',
        ];
        $show_submit = FALSE;
      }
      else {
21.10.2020
photos 6.0.x-dev :: photos.module
            $album_count = PhotosAlbum::userAlbumCount();
            if (!isset($album_count['rest']) || $album_count['rest'] < 1) {
              $description .= ' ' . Link::fromTextAndUrl(t('Create new album'), Url::fromRoute('node.add', [
                'node_type' => 'photos',
              ]))->toString();
            }
          }
        }
        elseif ($account->id() == $user->id()) {
        elseif ($account->id() == $user->id()) {
          // @todo check permissions and count before displaying.
          $create_album_link = Link::fromTextAndUrl(t('Create album'), Url::fromRoute('node.add', [
            'node_type' => 'photos',
          ]))->toString();
          $description = t('No albums yet, @link', ['@link' => $create_album_link]);
        }
        else {
          $description = t('No albums yet.');
03.06.2020
pluginreference 2.0.0 :: tests/src/Functional/PluginReferenceFieldWidgetTest.php
    $this->drupalLogin($this->adminUser);

    $this->drupalGet(Url::fromRoute('node.add', ['node_type' => $this->nodeType->id()]));

    $assert_session->fieldExists(sprintf('%s[0][plugin_id]', $this->fieldName));
    // Check that grouping per provider is enabled.
    $assert_session->elementExists('css', sprintf('select[name="%s[0][plugin_id]"] optgroup', $this->fieldName));
    $title = $this->randomMachineName();
    $edit = [
    $this->drupalLogin($this->adminUser);

    $this->drupalGet(Url::fromRoute('node.add', ['node_type' => $this->nodeType->id()]));

    $assert_session->fieldExists(sprintf('%s[0][plugin_id]', $this->fieldName));
    // Check that grouping per provider is disabled.
    $assert_session->elementNotExists('css', sprintf('select[name="%s[0][plugin_id]"] optgroup', $this->fieldName));
    $title = $this->randomMachineName();
    $edit = [
    $this->drupalLogin($this->adminUser);

    $this->drupalGet(Url::fromRoute('node.add', ['node_type' => $this->nodeType->id()]));

    $assert_session->fieldExists(sprintf('%s[plugin_id]', $this->fieldName));
    $title = $this->randomMachineName();
    $edit = [
      'title[0][value]' => $title,
      sprintf('%s[plugin_id]', $this->fieldName) => 'text_textfield',
    $assert_session->statusCodeEquals(403);

    $this->drupalGet(Url::fromRoute('node.add', ['node_type' => $this->nodeType->id()]));
    $assert_session->fieldExists(sprintf('%s[0][plugin_id]', $this->fieldName));
    $title = $this->randomMachineName();
    $edit = [
      'title[0][value]' => $title,
      sprintf('%s[0][plugin_id]', $this->fieldName) => 'Text field (text_textfield)',
    ];
03.06.2020
pluginreference 2.0.0 :: tests/src/FunctionalJavascript/PluginReferenceFieldWidgetConfigurationTest.php
      ])->save();

    $this->drupalGet(Url::fromRoute('node.add', ['node_type' => $this->nodeType->id()]));

    $page->findField('title[0][value]')->setValue('Test pluginreference');

    $plugin_id_field = $assert_session->fieldExists(sprintf('%s[0][plugin_id]', $this->fieldName));
    $plugin_id_field->selectOption('plugin_reference_test_block');
    drupal_flush_all_caches();

    $this->drupalGet(Url::fromRoute('node.add', ['node_type' => $this->nodeType->id()]));
    $page->findField('title[0][value]')->setValue('Test pluginreference 2');

    $plugin_id_field = $assert_session->fieldExists(sprintf('%s[0][plugin_id]', $this->fieldName));
    $plugin_id_field->selectOption('plugin_reference_test_block');

    $test_value_field = $assert_session->waitForField(sprintf('%s[0][configuration][test_value]', $this->fieldName));
      ])->save();

    $this->drupalGet(Url::fromRoute('node.add', ['node_type' => $this->nodeType->id()]));

    $page->findField('title[0][value]')->setValue('Test pluginreference');

    $plugin_id_field = $assert_session->fieldExists(sprintf('%s[0][plugin_id]', $this->fieldName));
    $plugin_id_field->setValue('test block');
    $plugin_id_field->keyDown(' ');
    drupal_flush_all_caches();

    $this->drupalGet(Url::fromRoute('node.add', ['node_type' => $this->nodeType->id()]));
    $page->findField('title[0][value]')->setValue('Test pluginreference 2');

    $plugin_id_field = $assert_session->fieldExists(sprintf('%s[0][plugin_id]', $this->fieldName));
    $plugin_id_field->setValue('test block');
    $plugin_id_field->keyDown(' ');
    $assert_session->waitOnAutocomplete()->click();
      ])->save();

    $this->drupalGet(Url::fromRoute('node.add', ['node_type' => $this->nodeType->id()]));

    $page->findField('title[0][value]')->setValue('Test pluginreference');

    $plugin_id_field = $assert_session->fieldExists(sprintf('%s[plugin_id]', $this->fieldName));
    $plugin_id_field->setValue('plugin_reference_test_block');
    drupal_flush_all_caches();

    $this->drupalGet(Url::fromRoute('node.add', ['node_type' => $this->nodeType->id()]));
    $page->findField('title[0][value]')->setValue('Test pluginreference 2');

    // The plugin_id_field are now checkboxes.
    $page->checkField(sprintf('%s[plugin_id][plugin_reference_test_block]', $this->fieldName));

    $test_value_field = $assert_session->waitForField(sprintf('%s[configuration][plugin_reference_test_block][test_value]', $this->fieldName));
05.10.2020
publication_date 8.x-2.x-dev :: tests/src/Functional/PublicationDateNodeFormTest.php
    // Unpublished by default.
    $title = $this->randomString() . '1';
    $this->drupalGet(Url::fromRoute('node.add', ['node_type' => 'test1']));
    $this->assertSession()->fieldValueEquals('published_at[0][value][date]', '');
    $this->assertSession()->fieldValueEquals('published_at[0][value][time]', '');
    $this->getSession()->getPage()->fillField('title[0][value]', $title);
    $this->getSession()->getPage()->findButton('Save')->submit();
    $node = $this->getNodeByTitle($title);
    $this->assertNull($node->published_at->value);
    // Published by default.
    $title = $this->randomString() . '2';
    $this->drupalGet(Url::fromRoute('node.add', ['node_type' => 'test2']));
    $this->assertSession()->fieldValueEquals('published_at[0][value][date]', '');
    $this->assertSession()->fieldValueEquals('published_at[0][value][time]', '');
    $this->getSession()->getPage()->fillField('title[0][value]', $title);
    $this->getSession()->getPage()->findButton('Save')->submit();
    $node = $this->getNodeByTitle($title);
    $this->assertNotEmpty($node->published_at->value);
    // Test node preview (unpublished)
    $this->drupalGet(Url::fromRoute('node.add', ['node_type' => 'test1']));
    $this->getSession()->getPage()->fillField('title[0][value]', $title);
    $this->getSession()->getPage()->findButton('Preview')->submit();
    $this->assertSame(200, $this->getSession()->getStatusCode());
  }

}
26.05.2020
responsive_preview 8.x-1.0 :: src/ResponsivePreview.php
    $url = NULL;

    if ($this->routeMatch->getRouteName() === 'node.add') {
      $node_type = $this->routeMatch->getParameter('node_type');
      if ($node_type && !$this->previewEnabled($node_type)) {
        return NULL;
      }
      $url = Url::fromRoute('<front>');
    }
27.09.2020
root 8.x-1.x-dev :: src/RootEditContent.php
    // Routes to include.
    $route_names = [
      'node.add',
      'entity.node.content_translation_add',
      'entity.node.content_translation_edit',
      'quick_node_clone.node.quick_clone',
      'entity.node.edit_form',
    ];
11.03.2021
route_ui 1.0.0-alpha2 :: tests/src/Functional/CustomActionLinksTest.php
    $assert->pageTextContains('Custom action link 1 details');
    $page->fillField('settings[label]', 'This is a block title');
    $page->fillField('settings[custom_action_links][0][route_details][route_name]', 'node.add');
    $page->fillField('settings[custom_action_links][0][route_details][route_parameters]', 'node_type=article');
    $link_text = 'Add an article<strong>!!!</strong>';
    $page->fillField('settings[custom_action_links][0][route_details][link_title]', $link_text);
    $page->pressButton('Save block');
    $assert->pageTextContains('The block configuration has been saved.');
    // Add another action link.
    $assert->elementExists('css', 'tr[data-drupal-selector="edit-blocks-customactionlinks"]')->clickLink('Configure');
    $page->fillField('settings[custom_action_links][1][route_details][route_name]', 'node.add');
    $page->fillField('settings[custom_action_links][1][route_details][route_parameters]', 'node_type=page');
    $page->pressButton('Save block');
    $assert->pageTextContains('The text for link is required.');
    $page_link_text = 'Add page';
    $page->fillField('settings[custom_action_links][1][route_details][link_title]', $page_link_text);
    $page->pressButton('Save block');
    $page->pressButton('Add and configure header');
    $page->checkField('options[empty]');
    $page->fillField('options[custom_action_links][0][route_details][route_name]', 'node.add');
    $page->fillField('options[custom_action_links][0][route_details][route_parameters]', 'node_type=article');
    $link_text = 'Add a page<strong>!!!</strong>';
    $page->fillField('options[custom_action_links][0][route_details][link_title]', $link_text);
    $page->pressButton('Apply');
    $page->pressButton('Save');
20.10.2020
scheduler 8.x-1.x-dev :: tests/src/Traits/SchedulerSetupTrait.php
      case 'node':
        $bundle = ($bundle == 'non-enabled') ? $this->nonSchedulerType : ($bundle ?? $this->type);
        $route = 'node.add';
        $type_parameter = 'node_type';
        break;

      case 'media':
        $bundle = ($bundle == 'non-enabled') ? $this->nonSchedulerMediaTypeName : ($bundle ?? $this->mediaTypeName);
        $route = 'entity.media.add_form';
17.04.2023
schemadotorg_demo 1.0.x-dev :: modules/schemadotorg_demo_admin/schemadotorg_demo_admin.module
  // @see schemadotorg_demo_admin_form_node_form_alter
  $route_name = \Drupal::routeMatch()->getRouteName();
  if ($route_name && in_array($route_name, ['node.add', 'entity.node.edit_form', 'mercury_editor.editor'])) {
    $id = $variables['attributes']['id'] ?? $variables['element']['#id'] ?? NULL;
    if ($id) {
      $variables['attributes']['data-schemadotorg-details-key'] = 'node-edit-form--' . $id;
    }
  }
}
07.06.2024
schemadotorg_experimental 1.0.x-dev :: modules/schemadotorg_devel/src/SchemaDotOrgDevelGenerate.php
   */
  public function menuLocalTasksAlter(array &$data, string $route_name, RefinableCacheableDependencyInterface $cacheability): void {
    if ($route_name !== 'node.add') {
      return;
    }

    $cacheability->addCacheContexts(['url.query_args', 'user.roles']);

    // Check for node generate tab.
      $node = $form_object->getEntity();
      if ($node->isNew()) {
        $url = Url::fromRoute('node.add', ['node_type' => $node->bundle()]);
        $query = $this->request()->query->all();
        if ($this->isDevelGenerateRequest()) {
          unset($query['schemadotorg_devel_generate']);
          $title = $this->t('Add content');
        }
        else {
03.09.2019
sector_content_audit 8.x-1.x-dev :: sector_content_audit.module
  if (!empty($bundle)) {
    $validRoutes = [
      'node.add',
      'entity.node.edit_form',
      'entity.node.content_translation_add'
    ];
    $auditFieldsAdded = \Drupal::configFactory()->getEditable('sector_content_audit.settings')
      ->get('sectorAudit_' . $bundle);
    if (in_array($route, $validRoutes) && $auditFieldsAdded == 1) {
27.09.2020
seeds_toolbar 8.x-1.11 :: seeds_toolbar.module
  $seeds_manager = \Drupal::service('seeds_toolbar.manager');

  $variables['content_links'] = $seeds_manager->buildMenu('node_type', 'node.add');
  $variables['content_collection'] = [
    '#type' => 'link',
    '#title' => t('Content'),
    '#url' => Url::fromRoute('system.admin_content'),
  ];
19.10.2020
simplenews 3.0.0-alpha1 :: simplenews.module
      return $help;

    case 'node.add':
      $type = $route_match->getParameter('node_type');
      $help = '';
      if ($type->id() == 'simplenews_issue') {
        $help = '<p>' . t('Add this newsletter issue to a newsletter by selecting a newsletter from the select list. To send this newsletter issue, first save the node, then use the "Newsletter" tab.') . "</p>\n";
        if (\Drupal::currentUser()->hasPermission('administer simplenews settings')) {
          $help .= '<p>' . t('Set default send options at <a href=":configuration">Administration > Configuration > Web services > Newsletters</a>.', [':configuration' => Url::fromRoute('simplenews.newsletter_list')->toString()]) . "</p>\n";
10.06.2020
social_course 8.x-2.11 :: src/Routing/RouteSubscriber.php
   */
  protected function alterRoutes(RouteCollection $collection) {
    if ($route = $collection->get('node.add')) {
      $route->setRequirements([
        '_course_content_add_access' => 'node:{node_type}',
      ]);
    }

    if ($route = $collection->get('node.add_page')) {
10.06.2020
social_course 8.x-2.11 :: src/Controller/NodeController.php
    // Only use node types the user has access to.
    // @todo See how we can refactor the andIf to remove it before drupal 10.
    $route = $this->routeProvider->getRouteByName('node.add');
    foreach ($this->entityTypeManager()->getStorage('node_type')->loadMultiple() as $type) {
      $route_match = new RouteMatch('node.add', $route, ['node_type' => $type], ['node_type' => $type->id()]);
      $access = $this
        ->entityTypeManager()
        ->getAccessControlHandler('node')
        ->createAccess($type->id(), NULL, [], TRUE)
        // Access checker applies only for "node.add" route, so we need to
        // check user access to this route but not to current route match.
    if (count($content) == 1) {
      $type = array_shift($content);
      return $this->redirect('node.add', [
        'node_type' => $type->id(),
      ]);
    }

    $build['#content'] = $content;
05.09.2020
sports_league 8.x-1.x-dev :: modules/sl_admin_ui/src/SLAdminUIWidgetBase.php
        '#theme' => 'item_list',
        '#items' => [
          Link::fromTextAndUrl('Add new', Url::fromRoute('node.add', ['node_type' => $this->pluginDefinition['bundle']])),
          Link::fromTextAndUrl('View all', $url = Url::fromUri('internal:/admin/sports_league/sl-admin-ui-content/' . $this->pluginDefinition['bundle'])),
        ],
      ],
      'content' => $this->contentTable(),
    ];
  }
07.12.2021
symlink 8.x-1.x-dev :: src/Controller/SymlinkController.php
   */
  public function addSymlink(NodeInterface $node) {
    return $this->redirect('node.add', ['node_type' => 'symlink'], [
      'absolute' => TRUE,
      'query' => array(
        'symlink' => "node/{$node->id()}",
      ),
    ]);
  }

Pages

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

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