load() public method

load data from node.
public load ( PHPCR\NodeInterface $node, string $webspaceKey, string $languageCode ) : mixed
$node PHPCR\NodeInterface
$webspaceKey string
$languageCode string
return mixed data of extension
Esempio n. 1
0
 /**
  * It should hydrate data from extensions.
  */
 public function testHydrateExtensionsData()
 {
     $expectedData = ['foo' => 'bar'];
     $document = new TestExtensionDocument();
     $this->hydrateEvent->getLocale()->shouldNotBeCalled();
     $this->hydrateEvent->getDocument()->willReturn($document);
     $this->inspector->getWebspace($document)->willReturn('sulu_io');
     $this->inspector->getLocale($document)->shouldBeCalled()->willReturn('de');
     $this->namespaceRegistry->getPrefix('extension_localized')->willReturn('ext_prefix');
     $this->extensionManager->getExtension('foobar', 'ext_1')->willReturn($this->extension->reveal());
     $this->extension->getName()->willReturn('ext_1');
     $this->extension->setLanguageCode('de', 'ext_prefix', '')->shouldBeCalled();
     $this->extension->load($this->node->reveal(), 'sulu_io', 'de')->willReturn($expectedData);
     $this->subscriber->handleHydrate($this->hydrateEvent->reveal());
     $this->assertEquals($document->getExtensionsData()->offsetGet('ext_1'), $expectedData);
 }
Esempio n. 2
0
 /**
  * load data from extension.
  */
 private function loadExtensionData(NodeInterface $node, ExtensionInterface $extension, $webspaceKey, $locale)
 {
     $extension->setLanguageCode($locale, $this->namespaceRegistry->getPrefix('extension_localized'), '');
     $data = $extension->load($node, $webspaceKey, $locale);
     return $extension->getContentData($data);
 }