Compare commits
2 Commits
9a4d3e2822
...
a0e79a272e
Author | SHA1 | Date |
---|---|---|
buttle | a0e79a272e | |
buttle | 3671b05828 |
|
@ -8,6 +8,7 @@ return [
|
|||
],
|
||||
'template_map' => [
|
||||
'omeka/index/index' => __DIR__ . '/../../../themes/archive/view/omeka/site/index.phtml',
|
||||
'omeka/search/results' => __DIR__ . '/../../../themes/archive/view/omeka/search/results.phtml',
|
||||
],
|
||||
],
|
||||
'view_helpers' => [
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
[info]
|
||||
name = "Archove site meta"
|
||||
name = "Archive site meta"
|
||||
description = "Add some meta vaule to pages"
|
||||
tags = ""
|
||||
license = "MIT"
|
||||
|
|
|
@ -15,9 +15,9 @@ class ArchiveSiteMetaFactory implements FactoryInterface
|
|||
return new ArchiveSiteMeta(
|
||||
$services->get('FormElementManager'),
|
||||
$services->get('Config')['DefaultSettings']['ArchiveSiteMetaBlockForm'],
|
||||
$settings->get('sitemeta_collections'),
|
||||
//$services->get('Config')['DefaultSettings']['ArchiveSiteMetaBlockForm'],
|
||||
//$settings->get('sitemeta_collections')
|
||||
$settings->get('sitemeta_collections')
|
||||
//$services->get('Omeka\SiteSettings'),
|
||||
//$services->get('Omeka\SiteSettings'),
|
||||
);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -7,6 +7,8 @@ use Omeka\Api\Representation\SitePageBlockRepresentation;
|
|||
use Omeka\Site\BlockLayout\AbstractBlockLayout;
|
||||
use Laminas\View\Renderer\PhpRenderer;
|
||||
|
||||
use ArchiveSiteMeta\Site\BlockLayout\ContainerInterface;
|
||||
|
||||
use Laminas\Form\Element;
|
||||
|
||||
use Laminas\Form\FormElementManager;
|
||||
|
@ -33,11 +35,15 @@ class ArchiveSiteMeta extends AbstractBlockLayout
|
|||
*/
|
||||
public function __construct(FormElementManager $formElementManager,
|
||||
array $defaultSettings,
|
||||
string $sitemeta_collections)
|
||||
string $sitemeta_collections
|
||||
//ContainerInterface $site_settings
|
||||
)
|
||||
|
||||
{
|
||||
$this->formElementManager = $formElementManager;
|
||||
$this->defaultSettings = $defaultSettings;
|
||||
$this->sitemeta_collections = $sitemeta_collections;
|
||||
//$this->services = $services;
|
||||
}
|
||||
|
||||
public function getLabel() {
|
||||
|
@ -54,14 +60,15 @@ class ArchiveSiteMeta extends AbstractBlockLayout
|
|||
$collection_options = [];
|
||||
foreach ( explode("\n", $this->sitemeta_collections) as $value ) {
|
||||
$key_value = explode("=", $value);
|
||||
$collection_options[$key_value[1]] = $key_value[0];
|
||||
$key = str_replace(array("\r", "\n"), '', $key_value[1]);
|
||||
$collection_options[trim($key)] = $key_value[0];
|
||||
}
|
||||
|
||||
$form->add([
|
||||
'name' => 'o:block[__blockIndex__][o:data][collection]',
|
||||
'type' => Element\Select::class,
|
||||
'options' => [
|
||||
'label' => "Collections",
|
||||
'label' => "Collection",
|
||||
'value_options' => $collection_options,
|
||||
],
|
||||
]);
|
||||
|
@ -72,7 +79,7 @@ class ArchiveSiteMeta extends AbstractBlockLayout
|
|||
$form->setData([
|
||||
'o:block[__blockIndex__][o:data][currator]' => $data['currator'],
|
||||
'o:block[__blockIndex__][o:data][project_date]' => $data['project_date'],
|
||||
'o:block[__blockIndex__][o:data][collection]' => $data['collection'],
|
||||
'o:block[__blockIndex__][o:data][collection]' => trim($data['collection']),
|
||||
]);
|
||||
$form->prepare();
|
||||
//$form->collections = $this->sitemeta_collections;
|
||||
|
|
|
@ -16,7 +16,7 @@ class ArchiveSiteMetaViewHelper extends AbstractHelper
|
|||
{
|
||||
|
||||
|
||||
public function __construct($omekaSettings)
|
||||
public function __construct($omekaSettings) #, $siteSettings)
|
||||
{
|
||||
$this->omekaSettings = $omekaSettings;
|
||||
}
|
||||
|
@ -55,27 +55,19 @@ class ArchiveSiteMetaViewHelper extends AbstractHelper
|
|||
return null;
|
||||
}
|
||||
|
||||
public function getCollections($sites){
|
||||
$collections = $this->omekaSettings->get('sitemeta_collections');
|
||||
$collection_options = [];
|
||||
|
||||
foreach ( explode("\n", $collections) as $value ) {
|
||||
$key_value = explode("=", str_replace(array("\r", "\n"), '',$value));
|
||||
$collection_options[trim($key_value[1])] = trim($key_value[0]);
|
||||
}
|
||||
//return $collections;
|
||||
//$site = $sites[0]->setting('sitemeta_collections');
|
||||
//$collections = [];
|
||||
$result = [];
|
||||
foreach ($sites as $site) {
|
||||
$settings = $this->getSiteMetaValues($site);
|
||||
if ($settings && !in_array($settings['collection'], $result)) {
|
||||
$name = $collection_options[$settings['collection']];
|
||||
$result[$settings['collection']] = $name;
|
||||
//array_push($collections, $settings['collection']);
|
||||
public function getCollections(){
|
||||
$sitemeta_collections = $this->omekaSettings->get('sitemeta_collections');
|
||||
$collections = [];
|
||||
foreach ( explode("\n", $sitemeta_collections) as $value ) {
|
||||
if ($value == "") {
|
||||
continue;
|
||||
}
|
||||
$key_value = explode("=", str_replace(array("\r", "\n"), '', $value));
|
||||
if ($key_value) {
|
||||
$collections[trim($key_value[1])] = trim($key_value[0]);
|
||||
}
|
||||
}
|
||||
return $result;
|
||||
return $collections;
|
||||
}
|
||||
|
||||
public function getPages()
|
||||
|
|
Loading…
Reference in New Issue