/** * {@inheritdoc} */ public function buildForm(FormBuilderInterface $builder, array $options) { if ($options['level']) { $builder->add('condition_pattern', 'choice', array('choices' => array('OR' => 'OR', 'AND' => 'AND'), 'attr' => array('class' => 'sf_filter_condition_pattern'))); } if ($options['condition_operator']) { $builder->add('condition_operator', 'choice', array('choices' => ConditionOperator::get($options['condition_operator']), 'attr' => array('class' => 'sf_filter_condition_operator'))); } $builder->add('name', null, array('required' => false, 'attr' => array('class' => 'sf_filter_text', 'style' => 'background: #FFFFFF;', 'data-index' => $options['data_index']))); }
/** * {@inheritdoc} */ public function buildForm(FormBuilderInterface $builder, array $options) { if ($options['level']) { $builder->add('condition_pattern', 'choice', array('choices' => array('AND' => 'AND', 'OR' => 'OR'), 'attr' => array('class' => 'sf_filter_condition_pattern'))); } if ($options['condition_operator']) { $builder->add('condition_operator', 'choice', array('choices' => ConditionOperator::get('date_from'), 'attr' => array('class' => 'sf_filter_condition_operator'))); } $builder->add('name', 'genemu_jquerydate', array('required' => false, 'widget' => 'single_text', 'format' => 'y-MM-dd', 'configs' => array('changeMonth' => true, 'changeYear' => true), 'attr' => array('class' => 'sf_filter_text sf_filter_text_min', 'data-index' => $options['data_index']))); }
/** * {@inheritdoc} */ public function buildForm(FormBuilderInterface $builder, array $options) { if ($options['level']) { $builder->add('condition_pattern', 'choice', array('choices' => array('OR' => 'OR', 'AND' => 'AND'), 'attr' => array('class' => 'sf_filter_condition_pattern'))); } if ($options['condition_operator']) { $builder->add('condition_operator', 'choice', array('choices' => ConditionOperator::get($options['condition_operator']), 'attr' => array('class' => 'sf_filter_condition_operator'))); } $opt = array('required' => false, 'empty_value' => '', 'choices' => $options['sf_choice'], 'attr' => array('class' => 'sf_filter_select', 'data-index' => $options['data_index'])); $builder->add('name', 'choice', $opt); }
/** * {@inheritdoc} */ public function buildForm(FormBuilderInterface $builder, array $options) { if ($options['level']) { $builder->add('condition_pattern', 'choice', array('choices' => array('OR' => 'OR', 'AND' => 'AND'), 'attr' => array('class' => 'sf_filter_condition_pattern'))); } if ($options['condition_operator']) { $builder->add('condition_operator', 'choice', array('choices' => ConditionOperator::get($options['condition_operator']), 'attr' => array('class' => 'sf_filter_condition_operator'))); } $entity_type = $options['entity_type'] ? $options['entity_type'] : 'entity'; $opt = array('required' => false, 'empty_value' => '', 'em' => $options['em'], 'class' => $options['entity_class'], 'property' => $options['property'], 'attr' => array('class' => 'sf_filter_select', 'data-index' => $options['data_index'])); if ($options['sf_query_builder']) { $query = function (EntityRepository $er) use($options) { return $er->createQueryBuilder($options['sf_query_builder']['alias'])->where($options['sf_query_builder']['where'])->orderBy($options['sf_query_builder']['order_field'], $options['sf_query_builder']['order_type']); }; $opt['query_builder'] = $query; } $builder->add('name', $entity_type, $opt); }
public function __construct($array) { if (!$array) { throw new \Exception('FilterFieldDescription::name IS NULL'); } $this->name = $array[0]; $this->type = isset($array[1]) ? $array[1] : 'text_filter'; $this->label = isset($array[2]) ? $array[2] : $array[0]; $this->count = isset($array[3]) ? $array[3] : 1; if (isset($array[4])) { if (!ConditionOperator::validate($array[4])) { throw new \Exception(sprintf("ConditionOperator %s does not exist", $array[1])); } $this->condition_operator = $array[4]; } else { $this->condition_operator = 'full_text'; } $this->options = isset($array[5]) ? $array[5] : array(); }