backdrop / backdrop-issues

Issue tracker for Backdrop core.
144 stars 40 forks source link

Remove the documentation for entity_type and entity options from url() #5891

Open avpaderno opened 1 year ago

avpaderno commented 1 year ago

The documentation for url() says that $options can contain these values:

entity_uri() does not call url(); any core method that implements EntityInterface::uri() does not return those values.

The current documentation comment is the same used in Drupal 7, but in Drupal 7 'entity_type' and 'entity' are effectively set from entity_uri().

// Pass the entity data to url() so that alter functions do not need to
// lookup this entity again.
$uri['options']['entity_type'] = $entity_type;
$uri['options']['entity'] = $entity;
return $uri;

That code does not exist in Backdrop core, in any function or method.

The documentation for url() should not document those values, since they are not used by url() nor any other function/method.

avpaderno commented 1 year ago

I checked some functions/methods calling url(), but none of them sets 'entity_type' or 'entity'. It seems the documentation comment has been copied from Drupal 7 without changing it when the code has been changed. In fact, in Drupal 7, entity_uri() sets those values.

// Pass the entity data to url() so that alter functions do not need to
// lookup this entity again.
$uri['options']['entity_type'] = $entity_type;
$uri['options']['entity'] = $entity;
return $uri;

That code does not exist in Backdrop core.

avpaderno commented 1 year ago

(At least this PR passes the phpcs tests.)

avpaderno commented 1 year ago

I tagged this issue with type - documentation, since the task is changing a documentation comment for a function. I am not sure the tag is used also for those documentation comments. I think it is, since documentation comments are the source of the API documentation.