<?php
namespace EasyRestaurantManager\Modules\Blocks;
use EasyRestaurantManager\Http\View;

class MenuBlocks {
    private $blockName = 'easy-restaurant-manager/menu-block';

    public function init()
    {
        register_block_type($this->blockName, array(
            'editor_script' => 'easy-restaurant-manager/menu-block',
            'render_callback' => [$this, 'render_menu_block']
        ));
    }

    public function render_menu_block($attributes)
    {
        return View::make('Blocks/MenuBlock', [
            'attributes' => $attributes,
            'menus' => BlockManager::getMenus()
        ]);
    }
}