TYPO3-Solr / ext-solr

A TYPO3 extension that integrates the Apache Solr search server with TYPO3 CMS. dkd Internet Service GmbH is developing the extension. Community contributions are welcome. See CONTRIBUTING.md for details.
GNU General Public License v3.0
137 stars 252 forks source link

`solr:form` VH does not find TypoScript settings when plugin was instantiated via `EXTBASEPLUGIN` #4212

Open snk-spo opened 2 weeks ago

snk-spo commented 2 weeks ago

I render the following via <f:cObject typoscriptObjectPath="lib.searchBar"/>

lib {
  searchBar = EXTBASEPLUGIN
  searchBar {
    extensionName = Solr
    pluginName = pi_search
    settings {
      search {
        targetPage = {$pages.search}
      }
    }
  }
}

to have the search bar available centrally in the navigation. But calling <solr:form> in the Form Fluid template does not respect the targetPage in any way,even though it is in the settings array, so f:uri(pageUid: settings.search.targetPage) works! Only the <solr:form> does not find it. If I also set plugin.tx_solr.search.targetPage = {$pages.search} it works, however.

Expected: The configuration in the EXTBASEPLUGIN should be found and also win over the global TypoScript, because everything under EXTBASEPLUGIN should effectively act like it was a FlexForm.

The ViewHelper render method does this, which seems to not be able to fetch settings from EXTBASEPLUGIN:

        $pageUid = $this->arguments['pageUid'] ?? null;
        if ($pageUid === null && !empty($this->getTypoScriptConfiguration()->getSearchTargetPage())) {
            $pageUid = $this->getTypoScriptConfiguration()->getSearchTargetPage();
        }
        $pageUid = (int)$pageUid;
dkd-kaehm commented 2 weeks ago

@snk-spo Thanks for reporting that issue. Please provide infos about versions-stack.

snk-spo commented 2 weeks ago

@dkd-kaehm Sorry, forgot, I am running TYPO3 12.4.22 with Solr 12.0.5 on PHP 8.3

snk-spo commented 2 weeks ago

Ah, I found the issue. It's a little bit unintuitive however. It works when removing the settings scope, like this:

lib {
  searchBar = EXTBASEPLUGIN
  searchBar {
    extensionName = Solr
    pluginName = pi_search
    search {
      targetPage = {$pages.search}
    }
  }
}

ext:solr does not have its Extbase plugin configuration stored under settings, of course (instead it just has a custom array of configurations on the plugin root level). The core documentation of EXTBASEPLUGIN is very sparse about the allowed configuration that can be passed with it (so I intuitively assumed it would be settings, because in Extbase bascially everything is either settings, view or persistence), and ext:solr has no example at all in its documentation, either, about how to insert the search bar other than as a regular CE.

So this is rather an issue about incomplete documentation on both ends, TYPO3 and ext:solr.

dkd-kaehm commented 2 weeks ago

@snk-spo Thanks for clarification. On which places of our docs did you expect a hints about that? Could you add it via pull-request?