Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /**
- * Class RankingConditionAdmin
- */
- class RankingConditionsAdmin extends AbstractAdmin
- {
- /**
- * {@inheritdoc}
- */
- protected function configureListFields(ListMapper $list)
- {
- $list->add('ctrMax', NumberType::class);
- }
- /**
- * {@inheritdoc}
- */
- protected function configureFormFields(FormMapper $form)
- {
- $form
- ->add('ctrMax', NumberType::class)
- ->add('ctrMin', NumberType::class)
- ;
- }
- }
- class RankingAdmin extends AbstractAdmin
- {
- protected $baseRoutePattern = 'ranking';
- /**
- * @param mixed $object
- *
- * @return string
- */
- // public function toString($object)
- // {
- // return sprintf("%s", $object->getName());
- // }
- /**
- * {@inheritdoc}
- */
- protected function configureListFields(ListMapper $list)
- {
- $list->add('name', TextType::class)
- ->add(
- '_action',
- 'actions', [
- 'actions' => [
- 'edit' => [],
- ],
- ]
- );
- }
- /**
- * {@inheritdoc}
- */
- protected function configureFormFields(FormMapper $form)
- {
- $form
- ->tab('General')->with('');
- $form
- ->add('name', TextType::class)
- ->add('defaultCtrMax', NumberType::class, array(
- 'required' => true,
- ))
- ->add('defaultCtrMin', NumberType::class, array(
- 'required' => true,
- ))
- ->add('defaultConversionMax', NumberType::class, array(
- 'required' => true,
- ))
- ->add('defaultConversionMax', NumberType::class, array(
- 'required' => true,
- ))
- ->end()
- ->end()
- ->tab('Conditions')
- ->with('');
- $form
- ->add(
- 'rankingConditions',
- CollectionType::class,
- array(
- 'type_options' => array(
- // Prevents the "Delete" option from being displayed
- 'delete' => false,
- 'delete_options' => array(
- // You may otherwise choose to put the field but hide it
- 'type' => 'hidden',
- // In that case, you need to fill in the options as well
- 'type_options' => array(
- 'mapped' => false,
- 'required' => false,
- )
- )
- )
- ), array(
- 'edit' => 'inline',
- 'inline' => 'table',
- 'sortable' => 'position',
- ))
- ->end()->end();
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement