Commit c8f6f3c8 authored by webchick's avatar webchick

Issue #2417445 by xjm, YesCT: Remove Url::toArray()

parent cb22bbde
......@@ -514,23 +514,6 @@ public function __toString() {
return $this->toString();
}
/**
* Returns all the information about the route.
*
* @return array
* An associative array containing all the properties of the route.
*
* @deprecated in Drupal 8.0.x-dev, will be removed before Drupal 9.0.
* Most usecases should use the URL object directly, like #type links. Other
* usecases should get the information from the URL object manually.
*/
public function toArray() {
return [
'url' => $this,
'options' => $this->getOptions(),
];
}
/**
* Returns the route information for a render array.
*
......
......@@ -168,13 +168,15 @@ public function getDefaultOperations(EntityInterface $entity) {
$operations['edit'] = array(
'title' => $this->t('Edit'),
'weight' => 10,
) + $entity->urlInfo("{$entity->entity_type}-field-edit-form")->toArray();
'url' => $entity->urlInfo("{$entity->entity_type}-field-edit-form"),
);
}
if ($entity->access('delete') && $entity->hasLinkTemplate("{$entity->entity_type}-field-delete-form")) {
$operations['delete'] = array(
'title' => $this->t('Delete'),
'weight' => 100,
) + $entity->urlInfo("{$entity->entity_type}-field-delete-form")->toArray();
'title' => $this->t('Delete'),
'weight' => 100,
'url' => $entity->urlInfo("{$entity->entity_type}-field-delete-form"),
);
}
$operations['storage-settings'] = array(
......
......@@ -259,7 +259,8 @@ function shortcut_renderable_links($shortcut_set = NULL) {
$links[$shortcut->id()] = array(
'type' => 'link',
'title' => $shortcut->label(),
) + $shortcut->getUrl()->toArray();
'url' => $shortcut->getUrl(),
);
$cache_tags = Cache::mergeTags($cache_tags, $shortcut->getCacheTags());
}
......
......@@ -138,23 +138,6 @@ public function testToString(array $urls) {
$this->assertSame($this->unroutedInternal, $urls[1]->toString());
}
/**
* Tests the toArray() method.
*
* @depends testFromUri
*
* @covers ::toArray
*/
public function testToArray(array $urls) {
$expected = Url::fromUri($this->unroutedExternal, ['external' => TRUE]);
$expected->setUnroutedUrlAssembler(\Drupal::service('unrouted_url_assembler'));
$this->assertEquals($expected, $urls[0]);
$expected = Url::fromUri($this->unroutedInternal);
$expected->setUnroutedUrlAssembler(\Drupal::service('unrouted_url_assembler'));
$this->assertEquals($expected, $urls[1]);
}
/**
* Tests the getRouteName() method.
*
......
......@@ -311,24 +311,6 @@ public function testMagicToString($urls) {
}
}
/**
* Tests the toArray() method.
*
* @param \Drupal\Core\Url[] $urls
* An array of Url objects.
*
* @depends testUrlFromRequest
*
* @covers ::toArray
*/
public function testToArray($urls) {
foreach ($urls as $index => $url) {
$expected = Url::fromRoute($this->map[$index][0], $this->map[$index][1], $this->map[$index][2]);
$expected->setUrlGenerator(\Drupal::urlGenerator());
$this->assertEquals($expected, $url);
}
}
/**
* Tests the getRouteName() method.
*
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment