/**
  * Adds the current collection's UID to the search form
  *
  * @access	protected
  *
  * @return	string		HTML input fields with current document's UID and parent ID
  */
 protected function addCurrentCollection()
 {
     // Load current collection.
     $list = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance('tx_dlf_list');
     if (!empty($list->metadata['options']['source']) && $list->metadata['options']['source'] == 'collection') {
         // Get collection's UID.
         return '<input type="hidden" name="' . $this->prefixId . '[collection]" value="' . $list->metadata['options']['select'] . '" />';
     } elseif (!empty($list->metadata['options']['params']['fq'])) {
         // Get collection's UID from search metadata.
         foreach ($list->metadata['options']['params']['fq'] as $id => $facet) {
             $facetKeyVal = explode(':', $facet, 2);
             if ($facetKeyVal[0] == 'collection_faceting' && !strpos($facetKeyVal[1], '" OR "')) {
                 $collectionId = tx_dlf_helper::getIdFromIndexName(trim($facetKeyVal[1], '(")'), 'tx_dlf_collections');
             }
         }
         return '<input type="hidden" name="' . $this->prefixId . '[collection]" value="' . $collectionId . '" />';
     }
     return '';
 }
 /**
  * Adds the current collection's UID to the search form
  *
  * @access	protected
  *
  * @return	string		HTML input fields with current document's UID and parent ID
  */
 protected function addCurrentCollection()
 {
     // Load current collection.
     $list = t3lib_div::makeInstance('tx_dlf_list');
     if (!empty($list->metadata['options']['source']) && $list->metadata['options']['source'] == 'collection') {
         // Get collection's UID.
         return '<input type="hidden" name="' . $this->prefixId . '[collection]" value="' . $list->metadata['options']['select'] . '" />';
     } else {
         if (!empty($list->metadata['options']['params']['fq'])) {
             // get collection's UID from search metadata
             foreach ($list->metadata['options']['params']['fq'] as $id => $facet) {
                 $facetKeyVal = explode(':', $facet, 2);
                 if ($facetKeyVal[0] == 'collection_faceting') {
                     $collectionId = tx_dlf_helper::getIdFromIndexName($facetKeyVal[1], 'tx_dlf_collections');
                 }
             }
             return '<input type="hidden" name="' . $this->prefixId . '[collection]" value="' . $collectionId . '" />';
         }
     }
     return '';
 }