This is used in order to add meta data arguments to content elements in the Backend. Usage: $html = '
Some HTML code
'; $result = (new HtmlAugmenter())->addAttributes($html, array('foo' => 'bar', 'bar' => 'baz')); will return '
Some HTML code
 /**
  * @param string $html
  * @param array $attributes
  * @param string $fallbackTagName
  * @param string $expectedResult
  * @param array $exclusiveAttributes
  * @test
  * @dataProvider addAttributesDataProvider
  */
 public function addAttributesTests($html, array $attributes, $fallbackTagName, $exclusiveAttributes, $expectedResult)
 {
     if ($fallbackTagName === null) {
         $fallbackTagName = 'div';
     }
     $actualResult = $this->htmlAugmenter->addAttributes($html, $attributes, $fallbackTagName, $exclusiveAttributes);
     $this->assertSame($expectedResult, $actualResult);
 }
 /**
  * Wrap the $content identified by $node with the needed markup for the backend.
  *
  * @param NodeInterface $node
  * @param string $property
  * @param string $content
  * @return string
  */
 public function wrapContentProperty(NodeInterface $node, $property, $content)
 {
     /** @var $contentContext ContentContext */
     $contentContext = $node->getContext();
     if ($contentContext->getWorkspaceName() === 'live' || !$this->privilegeManager->isPrivilegeTargetGranted('Neos.Neos:Backend.GeneralAccess')) {
         return $content;
     }
     if (!$this->nodeAuthorizationService->isGrantedToEditNode($node)) {
         return $content;
     }
     $attributes = array();
     $attributes['class'] = 'neos-inline-editable';
     $attributes['property'] = 'typo3:' . $property;
     $attributes['data-neos-node-type'] = $node->getNodeType()->getName();
     return $this->htmlAugmenter->addAttributes($content, $attributes, 'span');
 }
 /**
  * @test
  */
 public function wrapContentPropertyDoesNotAddEditingMetaDataIfEditNodePrivilegeIsNotGranted()
 {
     $this->mockContentContext->expects($this->atLeastOnce())->method('getWorkspaceName')->will($this->returnValue('not-live'));
     $this->mockPrivilegeManager->expects($this->atLeastOnce())->method('isPrivilegeTargetGranted')->with('Neos.Neos:Backend.GeneralAccess')->will($this->returnValue(true));
     $this->mockNodeAuthorizationService->expects($this->atLeastOnce())->method('isGrantedToEditNode')->will($this->returnValue(false));
     $this->mockHtmlAugmenter->expects($this->never())->method('addAttributes');
     $this->contentElementEditableService->wrapContentProperty($this->mockNode, 'someProperty', '<div>someRenderedPropertyValue</div>');
 }
 /**
  * @param NodeInterface $node
  * @param string $content
  * @param string $typoScriptPath
  * @return string
  */
 public function wrapCurrentDocumentMetadata(NodeInterface $node, $content, $typoScriptPath)
 {
     if ($this->needsMetadata($node, true) === false) {
         return $content;
     }
     $attributes = [];
     $attributes['data-node-__typoscript-path'] = $typoScriptPath;
     $attributes = $this->addGenericEditingMetadata($attributes, $node);
     $attributes = $this->addNodePropertyAttributes($attributes, $node);
     $attributes = $this->addDocumentMetadata($attributes, $node);
     $attributes = $this->addCssClasses($attributes, $node, []);
     return $this->htmlAugmenter->addAttributes($content, $attributes, 'div', ['typeof']);
 }