-
Notifications
You must be signed in to change notification settings - Fork 131
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #2204 from omeka/theme-provided-resource-page-bloc…
…k-layouts Theme provided resource page block layouts
- Loading branch information
Showing
2 changed files
with
52 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
34 changes: 34 additions & 0 deletions
34
application/src/Site/ResourcePageBlockLayout/ThemeProvidedResourcePageBlockLayout.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
<?php | ||
namespace Omeka\Site\ResourcePageBlockLayout; | ||
|
||
use Omeka\Api\Representation\AbstractResourceEntityRepresentation; | ||
use Laminas\View\Renderer\PhpRenderer; | ||
|
||
class ThemeProvidedResourcePageBlockLayout implements ResourcePageBlockLayoutInterface | ||
{ | ||
protected $label; | ||
protected $compatibleResourceNames; | ||
protected $partial; | ||
|
||
public function __construct($label, $compatibleResourceNames, $partial) | ||
{ | ||
$this->label = $label; | ||
$this->compatibleResourceNames = $compatibleResourceNames; | ||
$this->partial = $partial; | ||
} | ||
|
||
public function getLabel() : string | ||
{ | ||
return $this->label; | ||
} | ||
|
||
public function getCompatibleResourceNames() : array | ||
{ | ||
return $this->compatibleResourceNames; | ||
} | ||
|
||
public function render(PhpRenderer $view, AbstractResourceEntityRepresentation $resource) : string | ||
{ | ||
return $view->partial(sprintf('common/resource-page-block-layout/%s', $this->partial), ['resource' => $resource]); | ||
} | ||
} |