getName() public method

returns name of template.
public getName ( ) : string
return string
Example #1
0
 /**
  * {@inheritdoc}
  */
 public function remove(NodeInterface $node, PropertyInterface $property, $webspaceKey, $languageCode, $segmentKey)
 {
     // if exist remove property of node
     if ($node->hasProperty($property->getName())) {
         $node->getProperty($property->getName())->remove();
     }
 }
Example #2
0
 /**
  * {@inheritdoc}
  */
 public function write(NodeInterface $node, PropertyInterface $property, $userId, $webspaceKey, $languageCode, $segmentKey)
 {
     $value = $property->getValue();
     if ($value !== null && $value !== false && $value !== 'false' && $value !== '') {
         $node->setProperty($property->getName(), true);
     } else {
         $node->setProperty($property->getName(), false);
     }
 }
Example #3
0
 /**
  * {@inheritdoc}
  */
 public function read(NodeInterface $node, PropertyInterface $property, $webspaceKey, $languageCode, $segmentKey)
 {
     $value = '';
     if ($node->hasProperty($property->getName())) {
         /** @var \DateTime $propertyValue */
         $propertyValue = $node->getPropertyValue($property->getName());
         $value = $propertyValue->format('Y-m-d');
     }
     $property->setValue($value);
     return $value;
 }
Example #4
0
 /**
  * {@inheritdoc}
  */
 public function read(NodeInterface $node, PropertyInterface $property, $webspaceKey, $languageCode, $segmentKey)
 {
     $value = $this->defaultValue;
     if ($node->hasProperty($property->getName())) {
         $value = $node->getPropertyValue($property->getName());
     }
     // the RedirectType subscriber sets the internal link as a reference
     if ($value instanceof NodeInterface) {
         $value = $value->getIdentifier();
     }
     $property->setValue($value);
     return $value;
 }
 public function testHasValue()
 {
     $type = new ContactSelectionContentType($this->template, $this->contactManager->reveal(), $this->accountManager->reveal(), $this->serializer->reveal(), new CustomerIdConverter(), new IndexComparator());
     $this->property->getName()->willReturn('test');
     $this->node->hasProperty('test')->willReturn(true);
     $this->assertTrue($type->hasValue($this->node->reveal(), $this->property->reveal(), $this->webspaceKey, $this->locale, $this->segmentKey));
 }
Example #6
0
 /**
  * {@inheritdoc}
  */
 public function write(NodeInterface $node, PropertyInterface $property, $userId, $webspaceKey, $languageCode, $segmentKey)
 {
     $value = $property->getValue();
     if ($value !== null) {
         $node->setProperty($property->getName(), $this->removeValidation($this->removeIllegalCharacters($value)));
     } else {
         $this->remove($node, $property, $webspaceKey, $languageCode, $segmentKey);
     }
 }
Example #7
0
 /**
  * returns name of template.
  *
  * @return string
  */
 public function getName()
 {
     return $this->block->getName() . '-' . $this->property->getName() . ($this->index !== null ? '#' . $this->index : '');
 }
Example #8
0
 /**
  * {@inheritdoc}
  */
 public function remove(NodeInterface $node, PropertyInterface $property, $webspaceKey, $languageCode, $segmentKey)
 {
     foreach ($node->getProperties($property->getName() . '-*') as $nodeProperty) {
         $node->getProperty($nodeProperty->getName())->remove();
     }
 }
Example #9
0
 /**
  * {@inheritdoc}
  */
 public function remove(NodeInterface $node, PropertyInterface $property, $webspaceKey, $languageCode, $segmentKey)
 {
     if ($node->hasProperty($property->getName())) {
         $property = $node->getProperty($property->getName());
         $property->remove();
     }
 }
Example #10
0
 /**
  * {@inheritdoc}
  */
 public function hasValue(NodeInterface $node, PropertyInterface $property, $webspaceKey, $languageCode, $segmentKey)
 {
     return $node->hasProperty($property->getName());
 }
Example #11
0
 /**
  * {@inheritdoc}
  */
 public function remove(NodeInterface $node, PropertyInterface $property, $webspaceKey, $languageCode, $segmentKey = null)
 {
     $this->strategy->deleteByPath($property->getValue(), $webspaceKey, $languageCode, $segmentKey);
     if ($node->hasProperty($property->getName())) {
         $node->getProperty($property->getName())->remove();
     }
 }
Example #12
0
 public function __construct(PropertyInterface $property, ContentTypeInterface $contentType)
 {
     parent::__construct(sprintf('Property "%s" is unexcepted in content type "%s"', $property->getName(), get_class($contentType)));
     $this->property = $property;
     $this->contentType = $contentType;
 }