public function form(PhpRenderer $view)
 {
     // Normalize vocab terms for use in a select element.
     $terms = array_map('trim', explode(PHP_EOL, $this->vocab->terms()));
     $valueOptions = array_combine($terms, $terms);
     $select = new Select('customvocab');
     $select->setAttributes(['class' => 'terms to-require', 'data-value-key' => '@value'])->setEmptyOption('Select Below')->setValueOptions($valueOptions);
     return $view->formSelect($select);
 }
Example #2
0
 /**
  * Return a thumbnail type select element.
  *
  * @param PhpRenderer $view
  * @param SiteRepresentation $site
  * @param SiteBlockAttachmentRepresentation|null $block
  * @return string
  */
 public function thumbnailTypeSelect(PhpRenderer $view, SiteRepresentation $site, SitePageBlockRepresentation $block = null)
 {
     $types = $this->getServiceLocator()->get('Omeka\\File\\Manager')->getThumbnailTypes();
     $type = null;
     if ($block) {
         $type = $this->getData($block->data(), 'thumbnail_type');
     }
     $select = new Select('o:block[__blockIndex__][o:data][thumbnail_type]');
     $select->setValueOptions(array_combine($types, $types))->setValue($type);
     return '<label class="thumbnail-option">Thumbnail Type ' . $view->formSelect($select) . '</label>';
 }
Example #3
0
 public function getTemplate(PhpRenderer $view)
 {
     // Normalize vocab terms for use in a select element.
     $terms = array_map('trim', explode(PHP_EOL, $this->vocab->terms()));
     $valueOptions = array_combine($terms, $terms);
     $hidden = new Hidden('customvocab');
     $hidden->setAttributes(['class' => 'language'])->setValue($this->vocab->lang());
     $select = new Select('customvocab');
     $select->setAttributes(['class' => 'terms'])->setEmptyOption('Select Below')->setValueOptions($valueOptions);
     return $view->formHidden($hidden) . $view->formSelect($select);
 }