Skip to content

slub/liszt_common

Repository files navigation

Common Tools for the Liszt Portal

TYPO3 11 CC-BY

This package bundles common functionality for the Liszt Portal. This comprises the elasticsearch connection and translation of file formats.

Features

ClientEnabledController

You can obtain a Controller with easy access to elasticsearch by inheriting from ClientEnabledController.

use Slub\LisztCommon\Controller\ClientEnabledController;

class ActionController extends ClientEnabledController
{

  public function ExampleAction()
  {
      $this->initializeClient();
      $params = ...
      $entity = $this->elasticClient->search($params);
      ...

  }

}

Elasticsearch Configuration

In the extension configuration, you need to specify the elasticsearch host, password file, credentials path and HTTP CA certificate path.

Search Hit List Configuration

In the extension configuration, you may specify how many search results are shown in one page. For the pagination, you may set which pages before and after the current one are shown. The first and last page are always shown. Specify a comma separated list of numbers, which will be added and subtracted respectively from the current page.

Translation between XML and JSON

You can read in an XML document and translate it to a PHP array or JSON.

use Slub\LisztCommon\Common\XmlDocument;
...

$xmlDocument = XmlDocument::from($xmlString);
$array = $xmlDocument->toArray();
$json = $xmlDocument->toJson();

Maintainer

If you have any questions or encounter any problems, please do not hesitate to contact me.