浏览代码

Merge pull request #2303 from caponica/autocomplete_embed_fix

Fix to enable autocomplete in embedded Admins
Thomas 10 年之前
父节点
当前提交
9bfee2f8dd
共有 2 个文件被更改,包括 4 次插入5 次删除
  1. 2 3
      Controller/HelperController.php
  2. 2 2
      Resources/views/Form/form_admin_fields.html.twig

+ 2 - 3
Controller/HelperController.php

@@ -11,7 +11,6 @@
 
 
 namespace Sonata\AdminBundle\Controller;
 namespace Sonata\AdminBundle\Controller;
 
 
-use Symfony\Bundle\FrameworkBundle\Controller\Controller;
 use Symfony\Component\HttpKernel\Exception\NotFoundHttpException;
 use Symfony\Component\HttpKernel\Exception\NotFoundHttpException;
 use Symfony\Component\HttpFoundation\Response;
 use Symfony\Component\HttpFoundation\Response;
 use Symfony\Component\HttpFoundation\JsonResponse;
 use Symfony\Component\HttpFoundation\JsonResponse;
@@ -364,7 +363,7 @@ class HelperController
                 }
                 }
             } else {
             } else {
                 if (!$datagrid->hasFilter($property)) {
                 if (!$datagrid->hasFilter($property)) {
-                    throw new \RuntimeException(sprintf('To retrieve autocomplete items, you should add filter "%s" to "%s" in configureDatagridFilters() method.', $prop, get_class($targetAdmin)));
+                    throw new \RuntimeException(sprintf('To retrieve autocomplete items, you should add filter "%s" to "%s" in configureDatagridFilters() method.', $property, get_class($targetAdmin)));
                 }
                 }
 
 
                 $datagrid->setValue($property, null, $searchText);
                 $datagrid->setValue($property, null, $searchText);
@@ -383,7 +382,7 @@ class HelperController
         foreach ($results as $entity) {
         foreach ($results as $entity) {
             if ($toStringCallback !== null) {
             if ($toStringCallback !== null) {
                 if (!is_callable($toStringCallback)) {
                 if (!is_callable($toStringCallback)) {
-                    throw new \RuntimeException('Option "to_string_callback" doesn`t contain callable function.');
+                    throw new \RuntimeException('Option "to_string_callback" does not contain callable function.');
                 }
                 }
 
 
                 $label = call_user_func($toStringCallback, $entity, $property);
                 $label = call_user_func($toStringCallback, $entity, $property);

+ 2 - 2
Resources/views/Form/form_admin_fields.html.twig

@@ -289,8 +289,8 @@ file that was distributed with this source code.
                                 "{{ req_param_name_page_number }}": page,
                                 "{{ req_param_name_page_number }}": page,
 
 
                                 // admin
                                 // admin
-                                'uniqid': "{{ sonata_admin.admin.root.uniqid }}",
-                                'code':   "{{ sonata_admin.admin.root.code }}",
+                                'uniqid': "{{ sonata_admin.admin.uniqid }}",
+                                'code':   "{{ sonata_admin.admin.code }}",
                                 'field':  "{{ name }}"
                                 'field':  "{{ name }}"
 
 
                                 // other parameters
                                 // other parameters