Witaj Gościu! ( Zaloguj | Rejestruj )

Forum PHP.pl

> [Symfony][Symfony2]Edycja div-ow w koleckji formularzy
marcio
post
Post #1





Grupa: Zarejestrowani
Postów: 2 291
Pomógł: 156
Dołączył: 23.09.2007
Skąd: ITALY-MILAN

Ostrzeżenie: (10%)
X----


Hej mam maly i zarazem duzy problem mam oto i taki kod html wygenerowany przez Form Builder:
http://www6.shareimage.org/viewer.php?file...ks74xjjcwy1.bmp
Tam pokazalem glowny div-y kazdy z nich potem ma label i input pola.

Problem polega na tym ze do kazdego diva chcialbym dodac tez klase css.
Probowalem za pomoca:
  1. $builder->add('items', 'collection', array('attr' => array('class' => 'adjustRow')));

I nic
  1. $builder->add('items', 'collection', array('options' => array('attr' => array('class' => 'adjustRow'))));

Tez nic.
Probowalem tez metody:
  1. getDefaultOptions(array $options) { }

I tez nic.
Za cholere nie potrafie dodac tam klasy a potrzebuje bo jak nie to mi zle rozmieszcza elementy...

Czy ktos wie jak pomoc?!?
Go to the top of the page
+Quote Post
 
Start new topic
Odpowiedzi
marcio
post
Post #2





Grupa: Zarejestrowani
Postów: 2 291
Pomógł: 156
Dołączył: 23.09.2007
Skąd: ITALY-MILAN

Ostrzeżenie: (10%)
X----


Cytat(Mephistofeles @ 2.07.2012, 18:29:40 ) *

Co do linka to znam myslalem ze jest jakies latwiejsze rozwiazanie...

A co do Mezczyzna to sry ale nie chodze do polskie szkoly to sie troche pozapominalo.

Czyli tak jak myslalem nie ma innej metody oprocz theme z twig-a?

Domyslam sie ze ta czesc musialbym "nadpisac":
Cytat
form_widget_compound

(IMG:style_emoticons/default/questionmark.gif)

EDIT:
Tak wyglada generowanie formularza:
  1. /**
  2.   * Builds the form
  3.   *
  4.   * @param FormBuilder $builder The form builder
  5.   * @param array $options The options
  6.   * @return void
  7.   *
  8.   * @see Symfony\Component\Form\AbstractType::buildForm()
  9.   */
  10. public function buildForm(FormBuilder $builder, array $options)
  11. {
  12. $builder->add('items', 'collection');
  13. $settings = $this->objectToArray();
  14.  
  15. foreach ($this->items as $item)
  16. {
  17. if(isset($settings[$item->getId()]))
  18. {
  19. if($item->getGroup()->getId() == $settings[$item->getId()]['groupID'] && $item->getId() == $settings[$item->getId()]['itemID'])
  20. {
  21. if($item instanceof Item)
  22. {
  23. $builder->get('items')->add('item_' . $item->getId(), new ItemType($item, $settings[$item->getId()]['widget'], $settings[$item->getId()]));
  24. }
  25. }
  26. }
  27. else
  28. {
  29. if($item instanceof Item)
  30. {
  31. $builder->get('items')->add('item_' . $item->getId(), new ItemType($item, $this->widget));
  32. }
  33. }
  34. }
  35. }
  36.  
  37. /**
  38.   * Returns the name of this type
  39.   * @return string
  40.   */
  41. public function getName()
  42. {
  43. return 'configurationForm';
  44. }


Ten post edytował marcio 2.07.2012, 19:53:00
Go to the top of the page
+Quote Post

Posty w temacie


Reply to this topicStart new topic
2 Użytkowników czyta ten temat (2 Gości i 0 Anonimowych użytkowników)
0 Zarejestrowanych:

 



RSS Aktualny czas: 23.12.2025 - 10:03