- π§πͺBelgium lobsterr
After my investigation of many classes which implement MenuLinkInterface
1) MenuLinkInterface expects string
/** * Returns the localized title to be shown for this link. * * @return string * The title of the menu link. */ public function getTitle();
2) by default menu links are passed through DefaultMenuLinkTreeManipulators class:
$new_tree[(50000 + $instance->getWeight()) . ' ' . $instance->getTitle() . ' ' . $instance->getPluginId()] = $tree[$key];
As you can see in the core nothing special is done with getTitle method result and just a simple string is expected and not array. As a result I get warining:
Warning: Array to string conversion in Drupal\Core\Menu\DefaultMenuLinkTreeManipulators->generateIndexAndSort() (line 245
From here I can conclude: yes, it works! because conversion of an array to string, but definitely it is not what expected. It is not a bug.