get('net15.form.forge.reasons.manager')->getByPublicKey($request->request->get('reason')); $type = $container->get('net15.form.forge.type.manager')->getById((int)$request->request->get('customFieldType')); $order = count($reason->getFormForgeFields()); $label = $request->request->get('customFieldName');; $locale = $request->getLocale(); $required = $request->get('customFieldRequire'); $tag = $request->get('customfFieldTag'); $smallClass = $request->get('smallClass'); $mediumClass = $request->get('mediumClass'); $largeClass = $request->get('largeClass'); $xLageClass = $request->get('xLargeClass'); $getParameter = $request->get('get_parameter'); $formForgeField = $container->get('net15.form.forge.fields.manager')->create($reason, $label,$locale, $type, $required, $order, $tag, $smallClass, $mediumClass, $largeClass, $xLageClass, $getParameter); $formForgeField->getValues(); $container->get('net15.form.forge.reasons.manager')->addFormForgeField($reason, $formForgeField); return $this->render('@FormForge/FormForgeField/create.html.twig',array( 'customField' => $formForgeField, 'lang' => $locale )) ; } /** * @param string $publicKey * @param Request $request * @param ContainerInterface $container * @return Response */ public function editAction(string $publicKey, Request $request, ContainerInterface $container) { $field = $container->get('net15.form.forge.fields.manager')->getByPublicKey($publicKey); $locale = $request->getLocale(); $formForgeFieldsTypeList = $container->get('net15.form.forge.type.manager')->getAll(); return $this->render('@FormForge/FormForgeField/form.field.html.twig',array( 'customField' => $field, 'lang' => $locale, 'fieldsType'=>$formForgeFieldsTypeList )); } /** * @param Request $request * @param ContainerInterface $container * @return Response */ public function updateAction(Request $request, ContainerInterface $container){ $publicKey = $request->request->get('publicKey'); $label = $request->request->get('customFieldName'); $locale = $request->getLocale(); $required = $request->get('customFieldRequire'); $tag = $request->get('customfFieldTag'); $smallClass = $request->get('smallClass'); $mediumClass = $request->get('mediumClass'); $largeClass = $request->get('largeClass'); $xLargeClass = $request->get('xLargeClass'); $getParameter = $request->get('get_parameter'); $type = $container->get('net15.form.forge.type.manager')->getById($request->request->get('customFieldType')); $field = $container->get('net15.form.forge.fields.manager')->updateFormForgeField($publicKey, $label, $locale, $type, $required, $tag, $smallClass, $mediumClass, $largeClass, $xLargeClass, $getParameter); return $this->render('@FormForge/FormForgeField/create.html.twig',array( 'customField' => $field, 'lang' => $locale )) ; } public function deleteFieldAction(Request $request, ContainerInterface $container){ $formFieldDeleted = $container->get('net15.form.forge.fields.manager')->deleteField($request->get('formFieldPK')); return $this->render('@FormForge/FormForgeField/create.html.twig',array( 'customField' => $formFieldDeleted, 'lang' => $request->getLocale() )) ; } /** * @param Request $request * @param ContainerInterface $container * @return Response */ public function addValueAction(Request $request, ContainerInterface $container){ $publicKey = $request->request->get('publicKey'); $value = $request->request->get('customFieldValue'); $locale = $request->getLocale(); $formForgeField= $container->get('net15.form.forge.fields.manager')->addCustomFiedValue($publicKey,$value,$locale); return $this->render('@FormForge/FormForgeField/form.field.value.html.twig',array( 'customField' => $formForgeField, 'lang' => $locale )); } /** * @param Request $request * @param ContainerInterface $container * @return Response */ public function editValueAction(Request $request, ContainerInterface $container){ $customFieldValue = $container->get('net15.form.forge.fields.manager')->getCustomFieldValueByPublicKey($request->get('customFieldValuePK')); $locale = $request->getLocale(); return $this->render('@FormForge/FormForgeField/edit.field.value.html.twig',array( 'customFieldValue' => $customFieldValue, 'lang' => $locale )); } /** * @param Request $request * @param ContainerInterface $container * @return Response */ public function updateValueAction(Request $request, ContainerInterface $container) { $locale = $request->getLocale(); $publicKey = $request->request->get('customFieldValuePK'); $label = $request->request->get('customFieldValuelabel'); $formForgeField= $container->get('net15.form.forge.fields.manager')->updateCustomFieldValue($publicKey, $label, $locale); return $this->render('@FormForge/FormForgeField/form.field.value.html.twig',array( 'customField' => $formForgeField, 'lang' => $locale )); } /** * @param Request $request * @param ContainerInterface $container * @return Response */ public function removeValueAction(Request $request, ContainerInterface $container) { $locale = $request->getLocale(); $publicKey = $request->request->get('customFieldValue'); $formForgeField= $container->get('net15.form.forge.fields.manager')->removeCustomFieldValue($publicKey); return $this->render('@FormForge/FormForgeField/form.field.value.html.twig',array( 'customField' => $formForgeField, 'lang' => $locale )); } public function newValueFieldAction(Request $request, ContainerInterface $container){ $fieldValueId = $request->get('linguisticaId'); $fieldValue = $container->get('net15.form.forge.field.value.manager')->getById((int)$fieldValueId); return $this->render('@FormForge/FormForgeField/new.lang.field.html.twig',[ 'fieldValue'=>$fieldValue, 'className'=>$request->get('className'), 'routAdd'=>'form_forge_add_value_field' ]); } public function addValueFieldAction(Request $request, ContainerInterface $container){ $fieldValueId= $request->get('linguisticaId'); $fieldValue = $container->get('net15.form.forge.field.value.manager')->getById((int)$fieldValueId); $languages = array(); $languages['fr'] = $request->get('value_fr'); $languages['en'] = $request->get('value_en'); $languages['es'] = $request->get('value_es'); $label = $container->get('net15.linguistica.translator')->addLinguisticaStrValue($fieldValue, $languages); return new Response((string)$label); } public function updateOrderFieldAction(Request $request, ContainerInterface $container){ if ($request->isMethod('POST')){ $dataArray = $request->request->all(); if ($this->isCsrfTokenValid('Update_Order_Fields', $dataArray['_csrf_token'])){ $order = $container->get('net15.form.forge.fields.manager')->updateOrderFields($dataArray['fields_order']); if (!$order) return null; return new Response('true'); } } return new Response(''); } }