Example #1
0
 /**
  * @param String  $custom_separator
  * @param Boolean $highlightTheso
  *
  * @return mixed
  */
 public function get_serialized_values($custom_separator = false, $highlight = false)
 {
     if (0 === count($this->values)) {
         return null;
     }
     if ($this->is_multi()) {
         $separator = $custom_separator !== false ? $custom_separator : $this->databox_field->get_separator();
         return self::serialize_value($this->values, $separator, $highlight);
     }
     $value = current($this->values);
     /* @var $value Caption_Field_Value */
     if ($highlight) {
         return $value->highlight_thesaurus();
     }
     return $value->getValue();
 }
Example #2
0
 /**
  * @param String  $custom_separator
  * @param Boolean $highlightTheso
  *
  * @return mixed
  */
 public function get_serialized_values($custom_separator = false, $highlightTheso = false)
 {
     if ($this->databox_field->is_multi() === true) {
         if ($custom_separator !== false) {
             $separator = $custom_separator;
         } else {
             $separator = $this->databox_field->get_separator();
         }
         return self::serialize_value($this->values, $separator, $highlightTheso);
     } else {
         foreach ($this->values as $value) {
             /* @var $value Caption_Field_Value */
             if ($highlightTheso) {
                 return $value->highlight_thesaurus();
             } else {
                 return $value->getValue();
             }
         }
     }
     return null;
 }
Example #3
0
 public function testGet_separator()
 {
     $this->assertEquals('', $this->object_mono->get_separator());
     $this->assertEquals(';', $this->object_multi->get_separator());
 }
Example #4
0
 /**
  * Retrieve informations about one \databox metadata field
  *
  * @param  \databox_field $databox_field
  *
  * @return array
  */
 private function list_databox_metadata_field_properties(\databox_field $databox_field)
 {
     return ['id' => $databox_field->get_id(), 'namespace' => $databox_field->get_tag()->getGroupName(), 'source' => $databox_field->get_tag()->getTagname(), 'tagname' => $databox_field->get_tag()->getName(), 'name' => $databox_field->get_name(), 'labels' => ['fr' => $databox_field->get_label('fr'), 'en' => $databox_field->get_label('en'), 'de' => $databox_field->get_label('de'), 'nl' => $databox_field->get_label('nl')], 'separator' => $databox_field->get_separator(), 'thesaurus_branch' => $databox_field->get_tbranch(), 'type' => $databox_field->get_type(), 'indexable' => $databox_field->is_indexable(), 'multivalue' => $databox_field->is_multi(), 'readonly' => $databox_field->is_readonly(), 'required' => $databox_field->is_required()];
 }