Browse Source

#784 : Fix the bc break calls to get the form attributes

Baptiste "Talus" Clavie 13 years ago
parent
commit
aaa5e8732c
1 changed files with 3 additions and 2 deletions
  1. 3 2
      Form/Extension/Field/Type/FormTypeFieldExtension.php

+ 3 - 2
Form/Extension/Field/Type/FormTypeFieldExtension.php

@@ -90,10 +90,10 @@ class FormTypeFieldExtension extends AbstractTypeExtension
      */
      */
     public function buildView(FormViewInterface $view, FormInterface $form, array $options)
     public function buildView(FormViewInterface $view, FormInterface $form, array $options)
     {
     {
-        $sonataAdmin = $form->getAttribute('sonata_admin');
+        $sonataAdmin = $form->getConfig()->getAttribute('sonata_admin');
 
 
         // avoid to add extra information not required by non admin field
         // avoid to add extra information not required by non admin field
-        if ($form->getAttribute('sonata_admin_enabled', true)) {
+        if ($form->getConfig()->getAttribute('sonata_admin_enabled', true)) {
             $sonataAdmin['value'] = $form->getData();
             $sonataAdmin['value'] = $form->getData();
 
 
             // add a new block types, so the Admin Form element can be tweaked based on the admin code
             // add a new block types, so the Admin Form element can be tweaked based on the admin code
@@ -103,6 +103,7 @@ class FormTypeFieldExtension extends AbstractTypeExtension
 
 
             $types[] = sprintf('%s_%s', $baseName, $baseType);
             $types[] = sprintf('%s_%s', $baseName, $baseType);
             $types[] = sprintf('%s_%s_%s', $baseName, $sonataAdmin['field_description']->getName(), $baseType);
             $types[] = sprintf('%s_%s_%s', $baseName, $sonataAdmin['field_description']->getName(), $baseType);
+            
             if ($sonataAdmin['block_name']) {
             if ($sonataAdmin['block_name']) {
                 $types[] = $sonataAdmin['block_name'];
                 $types[] = $sonataAdmin['block_name'];
             }
             }