<?php

class LayoutsController extends AppBackendController {
	public $name = 'Layouts';

	# ~ Returns the list of blocks used in the layout  - - - - - - - - - - - - - - #
	function blocks($id, $locale = null) {
		$blocks = $this->Layout->getBlocks($id);
		$this->request->data['Blocks'] = $blocks;

		# If locale hasn't been set return json
		if (empty($locale)) {
			$this->json($blocks);
		}

		$this->layout = false;
		$this->set(compact('locale'));
		$this->render('../Elements/form/blocks');
	}

}
