Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added displayTitle() and displayDescription() for some entities. #1547

Open
wants to merge 1 commit into
base: develop
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions application/src/Api/Representation/AssetRepresentation.php
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,11 @@ public function altText()
return $this->resource->getAltText();
}

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 @@ -72,6 +72,16 @@ public function isPublic()
return $this->resource->isPublic();
}

/**
* 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 @@ -255,6 +255,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
5 changes: 3 additions & 2 deletions application/view/omeka/site/index/search.phtml
Original file line number Diff line number Diff line change
Expand Up @@ -28,13 +28,13 @@ $resourceControllers = [
<div class="<?php echo $resourceName; ?> results">
<h2><?php echo $translate($resourceLabels[$resourceName]); ?></h2>

<?php $titleMethod = $resourceName === 'site_pages' ? 'title' : 'displayTitle'; ?>
<?php if ($result['total']): ?>
<ul>
<?php foreach ($result['resources'] as $resource): ?>
<?php $hasThumbnail = $resource->primaryMedia(); ?>
<li>
<?php if (!$hasThumbnail): ?>
<?php echo $resource->link($resource->$titleMethod()); ?>
<?php echo $resource->link($resource->displayTitle()); ?>
<?php else: ?>
<?php echo $resource->linkPretty(); ?>
<?php endif; ?>
Expand All @@ -50,6 +50,7 @@ $resourceControllers = [
true
)
); ?>
<?php endif; ?>
</div>
<?php endforeach; ?>
<?php endif; ?>