block renders collection name correctly

This commit is contained in:
buttle 2021-05-31 17:30:38 +02:00
parent cb209b8737
commit dda5d7755a
5 changed files with 18 additions and 163 deletions

View File

@ -6,12 +6,18 @@ This module acompanies and is required by the Archive omeka theme
```
cd ./modules
https://git.hangar.org/arcHIVE-tech/ArchiveSiteMeta/archive/main.zip
get https://git.hangar.org/arcHIVE-tech/arc-hive-site-omeka-module/archive/main.zip
unzip main.zip
mv imageviewer/ ArchiveSiteMeta
mv arc-hive-site-omeka-module/ ArchiveSiteMeta
rm main.zip
```
## Configure
```
Collection One = collection1
Collection Two = collection2
Collection Three = collection3
```
## LISENCE
The module is released under the [MIT] License.

View File

@ -1,6 +1,6 @@
[info]
name = "Archive site meta"
description = "arcHIVE theme helper. Adds some meta vaule to pages and maps routes"
name = "Arc-hive site"
description = "arc-hIVE theme helper. Adds some meta vaule to pages and maps routes"
tags = ""
license = "MIT"
author = "Hangar.org"

View File

@ -39,157 +39,4 @@ class ConfigForm extends Form implements TranslatorAwareInterface
]);
}
/*
$this->add([
'name' => 'archiverepertory_item_set_folder',
'type' => PropertySelect::class,
'options' => [
'label' => 'Item set folder', // @translate
'empty_option' => 'Dont add folder', // @translate
'prepend_value_options' => [
'id' => 'Internal numeric id of the resource', // @translate
],
],
'attributes' => [
'class' => 'chosen-select',
'data-placeholder' => 'Select a property', // @translate
],
]);
*/
/*
$this->add([
'name' => 'archiverepertory_item_set_prefix',
'type' => Text::class,
'options' => [
'label' => 'Prefix for item sets', // @translate
'info' => $this->translate('Choose a prefix, for example "item:", "record:" or "doc:", to select the appropriate metadata when they are multiple.') // @translate
. ' ' . $this->translate('Let empty to use simply the first one.'), // @translate
],
]);
*/
/*
$this->add(
$this->getRadioForConversion('archiverepertory_item_set_convert',
$this->translate('Convert item set names')) // @translate
);
*/
/*
$this->add([
'name' => 'archiverepertory_item_folder',
'type' => PropertySelect::class,
'options' => [
'label' => 'Item folder', // @translate
'empty_option' => 'Dont add folder', // @translate
'prepend_value_options' => [
'id' => 'Internal numeric id of the resource', // @translate
],
],
'attributes' => [
'class' => 'chosen-select',
'data-placeholder' => 'Select a property', // @translate
],
]);
*/
/*
$this->add([
'name' => 'archiverepertory_item_prefix',
'type' => Text::class,
'options' => [
'label' => 'Prefix for items',
'info' => $this->translate('Choose a prefix, for example "item:", "record:" or "doc:", to select the appropriate metadata when they are multiple.') // @translate
. ' ' . $this->translate('Let empty to use simply the first one.'), // @translate
],
]);
*/
/*
$this->add(
$this->getRadioForConversion('archiverepertory_item_convert',
$this->translate('Convert item names')) // @translate
);
*/
/*
$radios = $this->getRadioForConversion('archiverepertory_media_convert',
$this->translate('Convert file names')); // @translate
$valueOptions = $radios->getValueOptions();
$valueOptions['hash'] = $this->translate('Hash filename (default Omeka)'); // @translate
$radios->setValueOptions($valueOptions);
$this->add($radios);
*/
/*
$inputFilter = $this->getInputFilter();
$inputFilter->add([
'name' => 'archiverepertory_item_set_folder',
'required' => false,
]);
$inputFilter->add([
'name' => 'archiverepertory_item_set_prefix',
'required' => false,
]);
$inputFilter->add([
'name' => 'archiverepertory_item_set_convert',
'required' => false,
]);
$inputFilter->add([
'name' => 'archiverepertory_item_folder',
'required' => false,
]);
$inputFilter->add([
'name' => 'archiverepertory_item_prefix',
'required' => false,
]);
$inputFilter->add([
'name' => 'archiverepertory_item_convert',
'required' => false,
]);
$inputFilter->add([
'name' => 'archiverepertory_media_convert',
'required' => false,
]);
}
protected function getSetting($name)
{
return $this->settings->get($name);
}
/*
protected function translate($args)
{
$translator = $this->getTranslator();
return $translator->translate($args);
}
*/
/*
protected function getRadioForConversion($name, $label)
{
$allow_unicode = Helpers::checkUnicodeInstallation();
$info = $this->translate('Depending on your server and your needs, to avoid some potential issues, you can choose or not to rename every folder to its Ascii equivalent (or only the first letter).') // @translate
. ' ' . $this->translate('In all cases, names are sanitized: "/", "\", "|" and other special characters are removed.'); // @translate
$radio = new Element\Radio($name);
$radio->setLabel($label);
$radio->setOptions(['info' => $info]);
$radio->setValue($this->getSetting($name));
$not_recommended = isset($allow_unicode['ascii'])
? ' ' . $this->translate('(not recommended because your server is not fully compatible with Unicode)') // @translate
: '';
$recommended = (isset($allow_unicode['cli']) || isset($allow_unicode['fs']))
? ' ' . $this->translate('(recommended because your server is not fully compatible with Unicode)') // @translate
: '';
$radio->setValueOptions([
'keep' => $this->translate('Keep name as it') . $not_recommended, // @translate
'spaces' => $this->translate('Convert spaces to underscores'), // @translate
'first letter' => $this->translate('Convert first letter only'), // @translate
'first and spaces' => $this->translate('Convert first letter and spaces'), // @translate
'full' => $this->translate('Full conversion to Ascii.') . $recommended, // @translate
]);
return $radio;
}
*/
}

View File

@ -49,7 +49,7 @@ class ArchiveSiteMeta extends AbstractBlockLayout
}
public function getLabel() {
return 'Archive site meta';
return 'Arc-hive site';
}
public function form(PhpRenderer $view,
@ -107,10 +107,12 @@ class ArchiveSiteMeta extends AbstractBlockLayout
}
//$this->storage_dir = $storage_dir;
//$mpdf->Output($this->storage_dir.'/asset/'.$site_title.'.pdf', \Mpdf\Output\Destination::FILE);
$archiveSiteHelper = $view->getHelperPluginManager()->get('archiveSiteMeta');
$collections = $archiveSiteHelper->getCollections();
return $view->partial('common/block-layout/site-meta', [
'artist' =>$block->dataValue('currator'),
'project_date' => $block->dataValue('project_date'),
'collection' => $block->dataValue('collection'),
'collection' => $collections[$block->dataValue('collection')],
'site' => $site,
'tech_document_link' => $tech_document_link
]);

View File

@ -77,8 +77,8 @@ class ArchiveSiteMetaViewHelper extends AbstractHelper
*/
public function getSiteImage($site)
{
foreach ($site->pages() as $page) {
foreach ($page->blocks() as $block) {
foreach ($site->pages() as $page) {
foreach ($page->blocks() as $block) {
if ($block->layout() === 'archiveSiteMeta') {
$attachments = $block->attachments();
if ($attachments) {
@ -86,9 +86,9 @@ class ArchiveSiteMetaViewHelper extends AbstractHelper
return $media->primaryMedia()->thumbnailUrl('large');
}
}
}
}
}
return null;
return null;
}
/**