<?php
namespace My\Component\GrafikKeuangan\Administrator\View\Item;

defined('_JEXEC') or die;

use Joomla\CMS\MVC\View\HtmlView as BaseHtmlView;
use Joomla\CMS\Toolbar\ToolbarHelper;

class HtmlView extends BaseHtmlView
{
	protected $form;
	protected $item;

	public function display($tpl = null)
	{
		$this->form = $this->get('Form');
		$this->item = $this->get('Item');

		$this->addToolbar();

		return parent::display($tpl);
	}

	protected function addToolbar()
	{
		ToolbarHelper::title('COM_GRAFIK_KEUANGAN_ITEM_TITLE', 'pencil-2');

		$canDo = \Joomla\CMS\Helper\ContentHelper::getActions('com_grafik_keuangan');

		if ($canDo && ($canDo->get('core.edit') || $canDo->get('core.create'))) {
			ToolbarHelper::apply('item.apply');
			ToolbarHelper::save('item.save');
			ToolbarHelper::save2new('item.save2new');
		}

		ToolbarHelper::cancel('item.cancel', 'JTOOLBAR_CLOSE');
	}
}
