Get an NodeType property into a backend module

Hello guys,

we got a multisite installation with ca. 15 “hosts”.
In every of this Hosts, there is a offers NodeType which shows host specific images of offers.
The offer-NodeType has an inspector input type field, where the editor can specify an ID so you can choose which images are shown. Every host has its own offer-images.

Now we need this ID for other purposes in our backend module.

I don’t know how to access this property of the offer-Nodetype due to the fact that I don’t have tha context ( host).

If it would be possible to get it via typoscript in the backend, that would also be fine.

I’m also open for any other way to solve my problem.

So in other words, I’m looking to find a way to access an value of an inspectior-field by a backend-module.

Thank you in advance.

Hello Damian,

the thing you are looking for is the\TYPO3\TYPO3CR\Domain\Service\ContextFactoryInterface wich you can easyli inject in your class.

 * @Flow\Inject
 * @var \TYPO3\TYPO3CR\Domain\Service\ContextFactoryInterface
protected $contextFactory;

Afterwards just create a context

$this->context = $this->contextFactory->create(
            'workspaceName' => 'live',
            'invisibleContentShown' => true,
            'inaccessableContentShown' => true,
            'removedContentShown' => true

And use it … in this example to get all children of /sites … meaning all root pages of the 15 hosts you mentioned

$sitesNode = $this->context->getNode('/sites');
$flowQuery = new FlowQuery([$sitesNode]);
$allSites = flowQuery->children()->get();

Attention: This is untested code … i use it like this often but this exact code is written from memory

Regards Martin