Skip to content
Snippets Groups Projects
Commit c721f4ac authored by Jess's avatar Jess Committed by Stefanos Petrakis
Browse files

Issue #3306201 by DieterHolvoet, Abhijith S, smustgrave, xjm: Add a title...

Issue #3306201 by DieterHolvoet, Abhijith S, smustgrave, xjm: Add a title getter to LinkItemInterface
parent b3149385
No related branches found
No related tags found
1 merge request!2901Issue #3130107: Extend unit test coverage for LanguageNegotiationContentEntity
This commit is part of merge request !2901. Comments created here will be created in the context of that merge request.
......@@ -40,4 +40,12 @@ public function isExternal();
*/
public function getUrl();
/**
* Gets the link title.
*
* @return string|null
* Returns the link title.
*/
public function getTitle(): ?string;
}
......@@ -175,6 +175,13 @@ public function getUrl() {
return Url::fromUri($this->uri, (array) $this->options);
}
/**
* {@inheritdoc}
*/
public function getTitle(): ?string {
return $this->title ?: NULL;
}
/**
* {@inheritdoc}
*/
......
......@@ -101,6 +101,7 @@ public function testLinkItem() {
$this->assertEquals($parsed_url['path'], $entity->field_test[0]->uri);
$this->assertEquals($title, $entity->field_test->title);
$this->assertEquals($title, $entity->field_test[0]->title);
$this->assertEquals($title, $entity->field_test[0]->getTitle());
$this->assertEquals($class, $entity->field_test->options['attributes']['class']);
$this->assertEquals($parsed_url['query'], $entity->field_test->options['query']);
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment