kitodo/kitodo-demo

Add span to facets title in Collection List

Closed this issue · 3 comments

In Collection List

In your demo installation, I see the following html code for a facet subtitle in a collection list

image

<ul>
  <li class="tx-dlf-search-no tx-dlf-search-ifsub">
    <span class="facet-sub-title">Erscheinungsort</span>
    <div class="dropdown-menu">
      <ul>

In my installation i get only

<ul>
  <li class="tx-dlf-search-no tx-dlf-search-ifsub">
    Erscheinungsort
    <div class="dropdown-menu">
      <ul>

The only way to get your <span ... is with a change in typo3conf/ext/dlf/Classes/Plugin/Search.php

I add in Line 557 this span

// Process results.
foreach ($facet as $field => $values) {
    $entryArray = [];
    $entryArray['title'] = '<span class="facet-sub-title">' . htmlspecialchars($this->conf['facets'][$field]) . '</span>';

@chrizzor: is there another or better way?
Otherwise i will do a PR.

Maybe the facet conf solves it. This is the current configuration of the presentation-demo:

plugin.tx_dlf_search.facetsConf {
  expAll = 0
  1 = TMENU
  1 {
    noBlur = 1
    wrap = <div class="dropdown-menu"><ul>|</ul></div>
    NO = 1
    NO {
      stdWrap.crop = 55 | &nbsp;... | 1
      doNotLinkIt.field = doNotLinkIt
      wrapItemAndSub = <li class="tx-dlf-search-no">|</li>
      allWrap = <span>|</span>
      }
    IFSUB < .NO
    IFSUB.wrapItemAndSub = <li class="tx-dlf-search-no tx-dlf-search-ifsub">|</li>
    IFSUB.allWrap = <span class="facet-sub-title">|</span>
    ACT < .NO
    ACT.wrapItemAndSub = <li class="tx-dlf-search-act">|</li>
    ACTIFSUB < .NO
    ACTIFSUB.wrapItemAndSub = <li class="tx-dlf-search-act tx-dlf-search-ifsub">|</li>
  }
  2 < .1
  2 {
    NO.stdWrap {
      crop = 55 | &nbsp;... | 1
      append.fieldRequired = count
      append = TEXT
      append.field = count
      append.wrap = &nbsp;(|)
    }
    IFSUB >
    ACT >
    ACTIFSUB >
    CUR < .NO
    CUR.wrapItemAndSub = <li class="tx-dlf-search-cur">|</li>
  }
}

Thank @chrizzor thats helpful, but if a facet is empty the headline is formated only as <span>HEADLINE</span>

This happens, e.b. if you click on a facet

image

after click to "Leipzig"
image

This should fix it:

plugin.tx_dlf_search.facetsConf {
  expAll = 0
  1 = TMENU
  1 {
    noBlur = 1
    wrap = <div class="dropdown-menu"><ul>|</ul></div>
    NO = 1
    NO {
      stdWrap.crop = 55 | &nbsp;... | 1
      doNotLinkIt.field = doNotLinkIt
      wrapItemAndSub = <li class="tx-dlf-search-no">|</li>
      allWrap = <span>|</span>
      }
    IFSUB < .NO
    IFSUB.wrapItemAndSub = <li class="tx-dlf-search-no tx-dlf-search-ifsub">|</li>
    IFSUB.allWrap = <span class="facet-sub-title">|</span>
    ACT < .NO
    ACT.wrapItemAndSub = <li class="tx-dlf-search-act">|</li>
    ACTIFSUB < .NO
    ACTIFSUB.wrapItemAndSub = <li class="tx-dlf-search-act tx-dlf-search-ifsub">|</li>
    ACTIFSUB.allWrap = <span class="facet-sub-title">|</span>
  }
  2 < .1
  2 {
    NO.stdWrap {
      crop = 55 | &nbsp;... | 1
      append.fieldRequired = count
      append = TEXT
      append.field = count
      append.wrap = &nbsp;(|)
    }
    IFSUB >
    ACT >
    ACTIFSUB >
    CUR < .NO
    CUR.wrapItemAndSub = <li class="tx-dlf-search-cur">|</li>
  }
}