33namespace Netgen \Bundle \InformationCollectionBundle \Controller \Admin ;
44
55use eZ \Bundle \EzPublishCoreBundle \Controller ;
6+ use eZ \Publish \Core \Helper \TranslationHelper ;
67use Netgen \Bundle \InformationCollectionBundle \API \Service \InformationCollection ;
78use Netgen \Bundle \InformationCollectionBundle \API \Value \InformationCollection \Content ;
89use Netgen \Bundle \InformationCollectionBundle \API \Value \InformationCollection \Query ;
@@ -27,21 +28,29 @@ class TreeController extends Controller
2728 */
2829 protected $ service ;
2930
31+ /**
32+ * @var \eZ\Publish\Core\Helper\TranslationHelper
33+ */
34+ private $ translationHelper ;
35+
3036 /**
3137 * TreeController constructor.
3238 *
3339 * @param \Netgen\Bundle\InformationCollectionBundle\API\Service\InformationCollection
3440 * @param \Symfony\Component\Translation\TranslatorInterface $translator
3541 * @param \Symfony\Component\Routing\RouterInterface $router
42+ * @param \eZ\Publish\Core\Helper\TranslationHelper $translationHelper
3643 */
3744 public function __construct (
3845 InformationCollection $ service ,
3946 TranslatorInterface $ translator ,
40- RouterInterface $ router
47+ RouterInterface $ router ,
48+ TranslationHelper $ translationHelper
4149 ) {
4250 $ this ->translator = $ translator ;
4351 $ this ->router = $ router ;
4452 $ this ->service = $ service ;
53+ $ this ->translationHelper = $ translationHelper ;
4554 }
4655
4756 /**
@@ -122,7 +131,7 @@ protected function getCollections(Content $content, $isRoot = false)
122131 return array (
123132 'id ' => $ content ->content ->id ,
124133 'parent ' => $ isRoot ? '# ' : '0 ' ,
125- 'text ' => $ content -> contentType -> getName ( $ languages [ 0 ] ) . ' ( ' . strval ($ count ->count ) . ') ' ,
134+ 'text ' => $ this -> translationHelper -> getTranslatedByMethod ( $ content -> contentType , ' getName ' ) . ' ( ' . strval ($ count ->count ) . ') ' ,
126135 'children ' => false ,
127136 'a_attr ' => array (
128137 'href ' => $ this ->router ->generate ('netgen_information_collection.route.admin.collection_list ' , ['contentId ' => $ content ->content ->id ]),
0 commit comments