Skip to content

Commit

Permalink
Added displayTitle() and displayDescription() for some entities.
Browse files Browse the repository at this point in the history
  • Loading branch information
Daniel-KM committed Apr 19, 2020
1 parent af6afdb commit 6e2031f
Show file tree
Hide file tree
Showing 4 changed files with 26 additions and 2 deletions.
5 changes: 5 additions & 0 deletions application/src/Api/Representation/AssetRepresentation.php
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,11 @@ public function assetUrl()
return $this->getFileUrl('asset', $this->filename());
}

public function displayTitle()
{
return $this->name();
}

public function thumbnail()
{
return $this;
Expand Down
10 changes: 10 additions & 0 deletions application/src/Api/Representation/SitePageRepresentation.php
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,16 @@ public function title()
return $this->resource->getTitle();
}

/**
* Alias of title().
*
* @return string
*/
public function displayTitle()
{
return $this->title();
}

/**
* Get the blocks assigned to this page.
*
Expand Down
10 changes: 10 additions & 0 deletions application/src/Api/Representation/SiteRepresentation.php
Original file line number Diff line number Diff line change
Expand Up @@ -243,6 +243,16 @@ public function owner()
->getRepresentation($this->resource->getOwner());
}

public function displayTitle()
{
return $this->title();
}

public function displayDescription()
{
return $this->summary();
}

public function siteUrl($siteSlug = null, $canonical = false)
{
if (!$siteSlug) {
Expand Down
3 changes: 1 addition & 2 deletions application/view/omeka/site/index/search.phtml
Original file line number Diff line number Diff line change
Expand Up @@ -28,10 +28,9 @@ $resourceControllers = [
<h2><?php echo $translate($resourceLabels[$resourceName]); ?></h2>

<?php if ($result['total']): ?>
<?php $titleMethod = $resourceName === 'site_pages' ? 'title' : 'displayTitle'; ?>
<ul>
<?php foreach ($result['resources'] as $resource): ?>
<li><?php echo $resource->link($resource->$titleMethod()); ?></li>
<li><?php echo $resource->link($resource->displayTitle()); ?></li>
<?php endforeach; ?>
</ul>
<?php echo $hyperlink(
Expand Down

0 comments on commit 6e2031f

Please sign in to comment.