supportsInternalLinks example

      // However, if it is inaccessible to the current user, do not display it       // to them.       '#default_value' => (!$item->isEmpty() && (\Drupal::currentUser()->hasPermission('link to any page') || $item->getUrl()->access())) ? static::getUriAsDisplayableString($item->uri) : NULL,
      '#element_validate' => [[static::class, 'validateUriElement']],
      '#maxlength' => 2048,
      '#required' => $element['#required'],
      '#link_type' => $this->getFieldSetting('link_type'),
    ];

    // If the field is configured to support internal links, it cannot use the     // 'url' form element and we have to do the validation ourselves.     if ($this->supportsInternalLinks()) {
      $element['uri']['#type'] = 'entity_autocomplete';
      // @todo The user should be able to select an entity type. Will be fixed       // in https://www.drupal.org/node/2423093.       $element['uri']['#target_type'] = 'node';
      // Disable autocompletion when the first character is '/', '#' or '?'.       $element['uri']['#attributes']['data-autocomplete-first-character-blacklist'] = '/#?';

      // The link widget is doing its own processing in       // static::getUriAsDisplayableString().       $element['uri']['#process_default_value'] = FALSE;
    }

    
Home | Imprint | This part of the site doesn't use cookies.