Skip to content
Snippets Groups Projects
Commit 67af32b3 authored by Tor F. Jacobsen's avatar Tor F. Jacobsen
Browse files

Resolve #3431948 "D11"

parent db5c226d
No related branches found
No related tags found
1 merge request!6Resolve #3431948 "D11"
Pipeline #414228 passed
......@@ -2,6 +2,6 @@ name: Menu Fast Edit
type: module
description: Enhances the Drupal admin UI to let menu links be added and edited quickly.
package: Administration
core_version_requirement: ^9 || ^10
core_version_requirement: ^10 || ^11
dependencies:
- menu_ui
......@@ -131,7 +131,7 @@ class MenuEditFormAlter implements ContainerInjectionInterface {
// Re-order the array to place title and url fields before "operations".
$keys = array_keys($element);
$operations_offset = array_search('operations', $keys);
$operations_offset = array_search('operations', $keys, TRUE);
$start = array_slice($element, 0, $operations_offset, TRUE);
$end = array_slice($element, $operations_offset, NULL, TRUE);
......@@ -153,10 +153,10 @@ class MenuEditFormAlter implements ContainerInjectionInterface {
// Get the raw uri from the link entity.
// @todo Re-work how to get the raw uri from the link entity.
$parts = explode(':', $link->getPluginId(), 2);
if (!empty($parts[1])) {
if (isset($parts[1]) && $parts[1] !== '') {
$uuid = $parts[1];
$entity = $this->entityRepository->loadEntityByUuid('menu_link_content', $uuid);
if (!empty($link)) {
if (isset($link)) {
/** @var \Drupal\link\Plugin\Field\FieldType\LinkItem $uri_obj */
$uri_obj = $entity->link;
$uri_value = $uri_obj->getEntity()->get('link')->getValue();
......@@ -291,7 +291,7 @@ class MenuEditFormAlter implements ContainerInjectionInterface {
// Update the URL, if applicable.
// @todo If "url" is an allowed override in MenuLinkContent, why does it throw an error during "updateDefinition"?
// @todo Update menu link content uri the correct way.
if (!empty($url)) {
if ($url !== '') {
$uri = self::getUserEnteredStringAsUri($url);
$menu_link_plugin = $this->menuLinkManager->createInstance($plugin_id);
/** @var \Drupal\menu_link_content\Entity\MenuLinkContent $entity */
......@@ -398,7 +398,7 @@ class MenuEditFormAlter implements ContainerInjectionInterface {
$uri = 'route:' . $string;
}
// Detect a schemeless string, map to 'internal:' URI.
elseif (!empty($string) && parse_url($string, PHP_URL_SCHEME) === NULL) {
elseif ($string !== '' && parse_url($string, PHP_URL_SCHEME) === NULL) {
// @todo '<front>' is valid input for BC reasons, may be removed by
// https://www.drupal.org/node/2421941
// - '<front>' -> '/'
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment