示例#1
0
 /**
  * turn a array property into a translatable property
  *
  * @param Schema   $property  simple string property
  * @param string[] $languages available languages
  *
  * @return Schema
  */
 public function makeArrayTranslatable(Schema $property, $languages)
 {
     $property->setType('array');
     $property->setItems($this->makeTranslatable(new Schema(), $languages));
     return $property;
 }
示例#2
0
 /**
  * turn a property into a translatable property
  *
  * @param Schema   $property  simple string property
  * @param string[] $languages available languages
  *
  * @return Schema
  */
 public function makeTranslatable(Schema $property, $languages)
 {
     $property->setType('object');
     $property->setTranslatable(true);
     array_walk($languages, function ($language) use($property) {
         $schema = new Schema();
         $schema->setType('string');
         $schema->setTitle('Translated String');
         $schema->setDescription('String in ' . $language . ' locale.');
         $property->addProperty($language, $schema);
     });
     return $property;
 }