Пример #1
0
 /**
  * @param RZ\Roadiz\Core\Entities\Node $node
  *
  * @return \Symfony\Component\Form\Form
  */
 protected function buildTranslateForm(Node $node)
 {
     $translations = $node->getHandler()->getUnavailableTranslations();
     $choices = [];
     foreach ($translations as $translation) {
         $choices[$translation->getId()] = $translation->getName();
     }
     if ($translations !== null && count($choices) > 0) {
         $builder = $this->getService('formFactory')->createBuilder('form')->add('nodeId', 'hidden', ['data' => $node->getId(), 'constraints' => [new NotBlank()]])->add('translationId', 'choice', ['label' => 'translation', 'choices' => $choices, 'required' => true]);
         return $builder->getForm();
     } else {
         return null;
     }
 }