Sulu\Component\Content\Mapper\Translation\MultipleTranslatedProperties::getName PHP Method

getName() public method

returns translated property name.
public getName ( string $key ) : string
$key string
return string
    public function getName($key)
    {
        // templates do not translate the template key
        if ($this->structureType === Structure::TYPE_SNIPPET) {
            if ($key === 'template') {
                return $key;
            }
        }
        if (isset($this->translatedProperties[$key])) {
            return $this->translatedProperties[$key]->getName();
        } else {
            throw new NoSuchPropertyException($key);
        }
    }

Usage Example

 /**
  * @dataProvider provideGetName
  */
 public function testGetName($structureType, $name, $expectedName)
 {
     $this->properties->setLanguage('de');
     $this->properties->setStructureType($structureType);
     $res = $this->properties->getName($name);
     $this->assertEquals($expectedName, $res);
 }
All Usage Examples Of Sulu\Component\Content\Mapper\Translation\MultipleTranslatedProperties::getName