You are here

public function TFTController::ajaxGetFolder in Taxonomy File Tree 8

Same name and namespace in other branches
  1. 3.x src/Controller/TFTController.php \Drupal\tft\Controller\TFTController::ajaxGetFolder()

Returns folder.

Return value

\Symfony\Component\HttpFoundation\JsonResponse Response.

Throws

\Drupal\Component\Plugin\Exception\InvalidPluginDefinitionException

\Drupal\Component\Plugin\Exception\PluginNotFoundException

1 string reference to 'TFTController::ajaxGetFolder'
tft.routing.yml in ./tft.routing.yml
tft.routing.yml

File

src/Controller/TFTController.php, line 627

Class

TFTController
Class TFTController.

Namespace

Drupal\tft\Controller

Code

public function ajaxGetFolder() {
  $tid = $_GET['tid'];
  $gid = _tft_get_group_gid($tid);
  $renderer = \Drupal::service('renderer');
  $data = $this
    ->content_table($tid, $gid);
  $ops_links = $this
    ->get_folder_operation_links($tid, $gid);
  return new JsonResponse([
    'data' => $renderer
      ->renderRoot($data),
    'parent' => _tft_get_parent_tid($tid, $gid),
    'ops_links' => $renderer
      ->renderRoot($ops_links),
  ]);
}