Compare commits
No commits in common. "a0e79a272e954762990ecdd7ca1742b7377f25c7" and "9a4d3e282220ce3275b6c3ead30e445e34c14bd4" have entirely different histories.
a0e79a272e
...
9a4d3e2822
|
@ -8,7 +8,6 @@ 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 = "Archive site meta"
|
||||
name = "Archove 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('Omeka\SiteSettings'),
|
||||
//$services->get('Omeka\SiteSettings'),
|
||||
$settings->get('sitemeta_collections'),
|
||||
//$services->get('Config')['DefaultSettings']['ArchiveSiteMetaBlockForm'],
|
||||
//$settings->get('sitemeta_collections')
|
||||
);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -7,8 +7,6 @@ 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;
|
||||
|
@ -35,15 +33,11 @@ class ArchiveSiteMeta extends AbstractBlockLayout
|
|||
*/
|
||||
public function __construct(FormElementManager $formElementManager,
|
||||
array $defaultSettings,
|
||||
string $sitemeta_collections
|
||||
//ContainerInterface $site_settings
|
||||
)
|
||||
|
||||
string $sitemeta_collections)
|
||||
{
|
||||
$this->formElementManager = $formElementManager;
|
||||
$this->defaultSettings = $defaultSettings;
|
||||
$this->sitemeta_collections = $sitemeta_collections;
|
||||
//$this->services = $services;
|
||||
}
|
||||
|
||||
public function getLabel() {
|
||||
|
@ -60,15 +54,14 @@ class ArchiveSiteMeta extends AbstractBlockLayout
|
|||
$collection_options = [];
|
||||
foreach ( explode("\n", $this->sitemeta_collections) as $value ) {
|
||||
$key_value = explode("=", $value);
|
||||
$key = str_replace(array("\r", "\n"), '', $key_value[1]);
|
||||
$collection_options[trim($key)] = $key_value[0];
|
||||
$collection_options[$key_value[1]] = $key_value[0];
|
||||
}
|
||||
|
||||
$form->add([
|
||||
'name' => 'o:block[__blockIndex__][o:data][collection]',
|
||||
'type' => Element\Select::class,
|
||||
'options' => [
|
||||
'label' => "Collection",
|
||||
'label' => "Collections",
|
||||
'value_options' => $collection_options,
|
||||
],
|
||||
]);
|
||||
|
@ -79,7 +72,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]' => trim($data['collection']),
|
||||
'o:block[__blockIndex__][o:data][collection]' => $data['collection'],
|
||||
]);
|
||||
$form->prepare();
|
||||
//$form->collections = $this->sitemeta_collections;
|
||||
|
|
|
@ -16,7 +16,7 @@ class ArchiveSiteMetaViewHelper extends AbstractHelper
|
|||
{
|
||||
|
||||
|
||||
public function __construct($omekaSettings) #, $siteSettings)
|
||||
public function __construct($omekaSettings)
|
||||
{
|
||||
$this->omekaSettings = $omekaSettings;
|
||||
}
|
||||
|
@ -55,19 +55,27 @@ class ArchiveSiteMetaViewHelper extends AbstractHelper
|
|||
return null;
|
||||
}
|
||||
|
||||
public function getCollections(){
|
||||
$sitemeta_collections = $this->omekaSettings->get('sitemeta_collections');
|
||||
$collections = [];
|
||||
foreach ( explode("\n", $sitemeta_collections) as $value ) {
|
||||
if ($value == "") {
|
||||
continue;
|
||||
}
|
||||
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));
|
||||
if ($key_value) {
|
||||
$collections[trim($key_value[1])] = trim($key_value[0]);
|
||||
$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']);
|
||||
}
|
||||
}
|
||||
return $collections;
|
||||
return $result;
|
||||
}
|
||||
|
||||
public function getPages()
|
||||
|
|
Loading…
Reference in New Issue