<commit_before><?php

/**
 * @copyright   Copyright (c) 2015 ublaboo <<EMAIL>>
 * @author      <NAME> <<EMAIL>>
 * @package     Ublaboo
 */

namespace Ublaboo\DataGrid\Toolbar;

use Nette\Utils\Html;
use Ublaboo\DataGrid\DataGrid;
use Ublaboo\DataGrid\Traits;

class ToolbarButton
{

	use Traits\TButton;
	use Traits\TLink;

	/**
	 * @var DataGrid
	 */
	protected $grid;

	/**
	 * @var string
	 */
	protected $href;

	/**
	 * @var array
	 */
	protected $params;

	/**
	 * @param DataGrid $grid
	 * @param string   $href
	 * @param string   $text
	 * @param array    $params
	 */
	public function __construct(DataGrid $grid, $href, $text, $params = [])
	{
		$this->grid = $grid;
		$this->href = $href;
		$this->text = $text;
		$this->params = $params;
	}


	/**
	 * Render toolbar button
	 * @return Html
	 */
	public function renderButton()
	{
		$link = $this->createLink($this->grid, $this->href, $this->params);

		$a = Html::el('a')->href($link);

		$this->tryAddIcon($a, $this->getIcon(), $this->getText());

		$a->addText($this->text);<commit_msg>Add a translation of text ToolbarButton <commit_after><?php

/**
 * @copyright   Copyright (c) 2015 ublaboo <<EMAIL>>
 * @author      <NAME> <<EMAIL>>
 * @package     Ublaboo
 */

namespace Ublaboo\DataGrid\Toolbar;

use Nette\Utils\Html;
use Ublaboo\DataGrid\DataGrid;
use Ublaboo\DataGrid\Traits;

class ToolbarButton
{

	use Traits\TButton;
	use Traits\TLink;

	/**
	 * @var DataGrid
	 */
	protected $grid;

	/**
	 * @var string
	 */
	protected $href;

	/**
	 * @var array
	 */
	protected $params;

	/**
	 * @param DataGrid $grid
	 * @param string   $href
	 * @param string   $text
	 * @param array    $params
	 */
	public function __construct(DataGrid $grid, $href, $text, $params = [])
	{
		$this->grid = $grid;
		$this->href = $href;
		$this->text = $text;
		$this->params = $params;
	}


	/**
	 * Render toolbar button
	 * @return Html
	 */
	public function renderButton()
	{
		$link = $this->createLink($this->grid, $this->href, $this->params);

		$a = Html::el('a')->href($link);

		$this->tryAddIcon($a, $this->getIcon(), $this->getText());

		$a->addText($this->grid->getTranslator()->translate($this->text));
{'fraction_non_alphanumeric': 0.18830570902394106, 'fraction_numerical': 0.003683241252302026, 'mean_word_length': 3.27755905511811, 'pattern_counts': {'":': 0, '<': 15, '<?xml version=': 0, '>': 44, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '5423807', 'n_tokens_mistral': 861, 'n_tokens_neox': 792, 'n_words': 171}