- 🇬🇧United Kingdom nlisgo
This has been resolved in https://www.drupal.org/node/3371753 →
Although this issue is older than the above I am marking this as the duplicate because the above has been marked "Closed (fixed)".
In \Drupal\Core\Entity\EntityInterface
:
public function urlInfo($rel = 'canonical', array $options = array());
In \Drupal\Core\Config\Entity\ConfigEntityBase
(which implements that interface):
public function urlInfo($rel = 'edit-form', array $options = []) {
This leads to retrieving the wrong URL when using the interface (even \Drupal\Core\Config\Entity\ConfigEntityInterface
, of course) for type hinting, as there's no way to see the $rel
parameter will be changed.
While this seems to be done on purpose for some reason (maybe some config entities don't have a canonical
URL, or it often makes more sense to give the edit form as the default for them), in my opinion this is very bad DX, as it adds another inconsistency that a developer just has to know/remember, and with which an IDE cannot help. It's also bad programming style, I'd say – I was pretty amazed PHP even allows this construct, normally it's (thankfully) rather picky when it comes to implementing interfaces.
Anyways, I'd be very much in favor of changing this back to using the same default parameter everywhere, or even no default at all if the other really isn't possible.
The same applies to getSystemPath()
, url()
and link()
, too, so all of these should be changed.
Closed: duplicate
11.0 🔥
entity system
Not all content is available!
It's likely this issue predates Contrib.social: some issue and comment data are missing.
This has been resolved in https://www.drupal.org/node/3371753 →
Although this issue is older than the above I am marking this as the duplicate because the above has been marked "Closed (fixed)".