Ejemplo n.º 1
0
 public static function getView($type)
 {
     $typeParts = explode('.', $type);
     $typeExtension = '.' . (count($typeParts) > 1 ? implode('.', array_slice($typeParts, 1)) : 'main');
     $typeClassName = Block::getBlockClass($typeParts[0]);
     $typeClasses = array_merge([$typeClassName], class_parents($typeClassName));
     foreach ($typeClasses as $typeClass) {
         $blockTypeView = Block::getBlockType($typeClass) . $typeExtension;
         $blockTypeView = strtolower($blockTypeView);
         $locations = ['coaster.blocks.', 'coaster::blocks.'];
         foreach ($locations as $location) {
             if (View::exists($location . $blockTypeView)) {
                 return $location . $blockTypeView;
             }
         }
     }
     return null;
 }