示例#1
0
 /**
  * @param FormBuilderInterface $builder
  * @param array                $options
  */
 public function buildForm(FormBuilderInterface $builder, array $options)
 {
     $choices = [];
     if ($reports = $this->model->getReportsWithGraphs()) {
         foreach ($reports as $report) {
             $choices[$report['name']] = [];
             $graphs = unserialize($report['graphs']);
             foreach ($graphs as $graph) {
                 $graphValue = $report['id'] . ":" . $graph;
                 $choices[$report['name']][$graphValue] = $graph;
             }
         }
     }
     // Build a list of data sources
     $builder->add('graph', 'choice', ['choices' => $choices, 'expanded' => false, 'multiple' => false, 'label' => 'mautic.report.report.form.choose_graphs', 'label_attr' => ['class' => 'control-label'], 'empty_value' => false, 'required' => false, 'attr' => ['class' => 'form-control']]);
     if (!empty($options["action"])) {
         $builder->setAction($options["action"]);
     }
 }