original_string: public function childElementsAction(Request $request)
      {
          $tid = $request->get('tree_id');
          $layoutareaId = $request->get('layoutarea_id');
          $language = $request->get('language', 'de');
  
          $translator = $this->get('translator');
          $treeManager = $this->get('phlexible_tree.tree_manager');
          $teaserManager = $this->get('phlexible_teaser.teaser_manager');
          $elementService = $this->get('phlexible_element.element_service');
          $elementtypeService = $this->get('phlexible_elementtype.elementtype_service');
          $iconResolver = $this->get('phlexible_element.icon_resolver');
  
          $data = [];
          $data[] = [
              'id' => '0',
              'title' => $translator->trans('elements.first', [], 'gui'),
              'icon' => $iconResolver->resolveIcon('_top.gif'),
          ];
  
          $tree = $treeManager->getByNodeId($tid);
          $treeNode = $tree->get($tid);
          $treeNodePath = $tree->getPath($treeNode);
  
          $layoutarea = $elementtypeService->findElementtype($layoutareaId);
          $teasers = $teaserManager->findForLayoutAreaAndTreeNodePath($layoutarea, $treeNodePath);
  
          foreach ($teasers as $teaser) {
              $teaserElement = $elementService->findElement($teaser->getTypeId());
              $teaserElementVersion = $elementService->findLatestElementVersion($teaserElement);
              $data[] = [
                  'id' => $teaser->getId(),
                  'title' => $teaserElementVersion->getBackendTitle($language),
                  'icon' => $iconResolver->resolveTeaser($teaser, $language),
              ];
          }
  
          return new JsonResponse(['elements' => $data]);
      }
code: public function childElementsAction(Request $request)
      {
          $tid = $request->get('tree_id');
          $layoutareaId = $request->get('layoutarea_id');
          $language = $request->get('language', 'de');
  
          $translator = $this->get('translator');
          $treeManager = $this->get('phlexible_tree.tree_manager');
          $teaserManager = $this->get('phlexible_teaser.teaser_manager');
          $elementService = $this->get('phlexible_element.element_service');
          $elementtypeService = $this->get('phlexible_elementtype.elementtype_service');
          $iconResolver = $this->get('phlexible_element.icon_resolver');
  
          $data = [];
          $data[] = [
              'id' => '0',
              'title' => $translator->trans('elements.first', [], 'gui'),
              'icon' => $iconResolver->resolveIcon('_top.gif'),
          ];
  
          $tree = $treeManager->getByNodeId($tid);
          $treeNode = $tree->get($tid);
          $treeNodePath = $tree->getPath($treeNode);
  
          $layoutarea = $elementtypeService->findElementtype($layoutareaId);
          $teasers = $teaserManager->findForLayoutAreaAndTreeNodePath($layoutarea, $treeNodePath);
  
          foreach ($teasers as $teaser) {
              $teaserElement = $elementService->findElement($teaser->getTypeId());
              $teaserElementVersion = $elementService->findLatestElementVersion($teaserElement);
              $data[] = [
                  'id' => $teaser->getId(),
                  'title' => $teaserElementVersion->getBackendTitle($language),
                  'icon' => $iconResolver->resolveTeaser($teaser, $language),
              ];
          }
  
          return new JsonResponse(['elements' => $data]);
      }
code_tokens: public function childElementsAction ( Request $ request ) { $ tid = $ request -> get ( 'tree_id' ) ; $ layoutareaId = $ request -> get ( 'layoutarea_id' ) ; $ language = $ request -> get ( 'language' , 'de' ) ; $ translator = $ this -> get ( 'translator' ) ; $ treeManager = $ this -> get ( 'phlexible_tree.tree_manager' ) ; $ teaserManager = $ this -> get ( 'phlexible_teaser.teaser_manager' ) ; $ elementService = $ this -> get ( 'phlexible_element.element_service' ) ; $ elementtypeService = $ this -> get ( 'phlexible_elementtype.elementtype_service' ) ; $ iconResolver = $ this -> get ( 'phlexible_element.icon_resolver' ) ; $ data = [ ] ; $ data [ ] = [ 'id' => '0' , 'title' => $ translator -> trans ( 'elements.first' , [ ] , 'gui' ) , 'icon' => $ iconResolver -> resolveIcon ( '_top.gif' ) , ] ; $ tree = $ treeManager -> getByNodeId ( $ tid ) ; $ treeNode = $ tree -> get ( $ tid ) ; $ treeNodePath = $ tree -> getPath ( $ treeNode ) ; $ layoutarea = $ elementtypeService -> findElementtype ( $ layoutareaId ) ; $ teasers = $ teaserManager -> findForLayoutAreaAndTreeNodePath ( $ layoutarea , $ treeNodePath ) ; foreach ( $ teasers as $ teaser ) { $ teaserElement = $ elementService -> findElement ( $ teaser -> getTypeId ( ) ) ; $ teaserElementVersion = $ elementService -> findLatestElementVersion ( $ teaserElement ) ; $ data [ ] = [ 'id' => $ teaser -> getId ( ) , 'title' => $ teaserElementVersion -> getBackendTitle ( $ language ) , 'icon' => $ iconResolver -> resolveTeaser ( $ teaser , $ language ) , ] ; } return new JsonResponse ( [ 'elements' => $ data ] ) ; }
docstring: List all child element types.
  
  @param Request $request
  
  @return JsonResponse
  @Route("/childelements", name="teasers_layout_childelements")
docstring_tokens: List all child element types .