public function getAllLayoutsAction() { // get all classes $resultList = []; $mapping = []; $customLayouts = new Object\ClassDefinition\CustomLayout\Listing(); $customLayouts->setOrder("ASC"); $customLayouts->setOrderKey("name"); $customLayouts = $customLayouts->load(); foreach ($customLayouts as $layout) { $mapping[$layout->getClassId()][] = $layout; } $classList = new Object\ClassDefinition\Listing(); $classList->setOrder("ASC"); $classList->setOrderKey("name"); $classList = $classList->load(); foreach ($classList as $class) { $classMapping = $mapping[$class->getId()]; if ($classMapping) { $resultList[] = ["type" => "master", "id" => $class->getId() . "_" . 0, "name" => $class->getName()]; foreach ($classMapping as $layout) { $resultList[] = ["type" => "custom", "id" => $class->getId() . "_" . $layout->getId(), "name" => $class->getName() . " - " . $layout->getName()]; } } } $this->_helper->json(["data" => $resultList]); }