if ($node === 'root'
) { try { $query =
$this->
getSiteRepository()->
getGroupListQuery();
$sites =
$query->
getArrayResult();
$this->
View()->
assign(['success' => true, 'nodes' =>
$sites]);
} catch (Exception
$e) { $this->
View()->
assign(['success' => false, 'message' =>
$e->
getMessage()]);
} } else { try { // Call the getSitesByNodeName helper function, which will return an array containing all children of that node
$sites =
$this->
getSitesByNodeName($node);
// Hand that array to the view
$this->
View()->
assign(['success' => true, 'nodes' =>
$sites]);
} catch (Exception
$e) { // Catch all errors
$this->
View()->
assign(['success' => false, 'message' =>
$e->
getMessage()]);
} } } /**
* this function enables the user to create groups
* after taking a groupName and a templateVariable, it will check if either one already exists and if so, throw an exception
* otherwise it will append the new group to cmsPositions in s_core_config
*/