add('name') ->add('description') ->add('enable') ->add('template') ; } /** * @param ListMapper $listMapper */ protected function configureListFields(ListMapper $listMapper) { $listMapper ->add('name') ->add('description') ->add('enable') ->add('_action', null, array( 'actions' => array( 'show' => array(), 'edit' => array(), 'delete' => array() ) )) ; } /** * @param FormMapper $formMapper */ protected function configureFormFields(FormMapper $formMapper) { $template_example = " initial_place: state_two places: - state_one - state_two - state_three transitions: one_to_two: from: state_one to: state_two two_to_three: from: state_two to: state_three two_to_one: from: state_two to: state_one three_to_one: from: state_three to: state_one "; // Create => template_example $tempate_options = array("attr" => array('style' => 'height:500px;')); if(is_null($this->getSubject()->getId())) { $tempate_options['data'] = $template_example; } else { $this->parameters = array('workflow_name' => $this->getSubject()->getName()); } $_supports = WorkFlowEntityClasses::getClass(); $supports = array(); foreach($_supports as $key => $class) { if(class_exists($key)) { $supports[$key] = $key; } } $formMapper ->add('name') ->add('description') ->add('enable') ->add('type', 'choice', array('choices' => array('state_machine' => 'state_machine', 'workflow' => 'workflow'))) ->add('markingType', 'choice', array('choices' => array('single_state' => 'single_state', 'multiple_state' => 'multiple_state'))) ->add('markingName', 'choice', array('choices' => array('currentState' => 'currentState'))) ->add('support', 'choice', array('choices' => $supports,'multiple' => true, 'required' => true)) ->add('template', null, $tempate_options) ->setHelps(array( 'name' => $this->trans("helps.workflow_label_name"), 'type' => $this->trans("helps.workflow_label_type"), 'markingType' => $this->trans("helps.workflow_label_marking_type"), 'markingName' => $this->trans("helps.workflow_label_marking_name"), 'template' => $this->trans("helps.workflow_label_template"), )) ; } /** * @param ShowMapper $showMapper */ protected function configureShowFields(ShowMapper $showMapper) { $showMapper ->add('id') ->add('name') ->add('description') ->add('enable') ->add('created') ->add('updated') ->add('type') ->add('markingType') ->add('markingName') ->add('support') ->add('template','string', array('template' => 'WorkflowBundle:Workflow:show_template.html.twig')) ; } }