Botões do JToolBarHelper::editList

  • thd
  • Avatar de thd Autor do Tópico
  • Offline
  • JCB! Colaborador
  • JCB! Colaborador
Mais
11 anos 8 meses atrás #95174 por thd
thd created the topic: Botões do JToolBarHelper::editList
Boa tarde a todos. Estou estudando o core do joomla 2.5 parte de criação de componente e me deparei com a seguinte questão: No arquivo view.html.php eu chamo uma função addtoolbar
protected function addToolbar(){          
            JToolBarHelper::addNew('carro.add');
            JToolBarHelper::editList('carro.edit');
            JToolBarHelper::deleteList('', 'carros.delete');
        }

a função estatica editList executa o seguinte código:
public static function editList($task = 'edit', $alt = 'JTOOLBAR_EDIT')
	{
		$bar = JToolBar::getInstance('toolbar');
		// Add an edit button.
		$bar->appendButton('Standard', 'edit', $alt, $task, true);
	}
e a função appendButton faz:
public function appendButton()
	{
		// Push button onto the end of the toolbar array.
		$btn = func_get_args();
		array_push($this->_bar, $btn);
		return true;
	}

porém essas funções não explicam como o código do botão é gerado no html através da função fetchButton na classe /libraries/joomla/html/toolbar/button/standart.php:
<li class="button" id="toolbar-edit">
<a href="#" onclick="if (document.adminForm.boxchecked.value==0){alert('Por favor, selecione através da lista');}else{ Joomla.submitbutton('carro.edit')}" class="toolbar">
<span class="icon-32-edit">
</span>
Editar
</a>
</li>

ou seja, em que momento da criação da página a função fetchButton é chamada ?
//função que cria o código html para o botão
public function fetchButton($type = 'Standard', $name = '', $text = '', $task = '', $list = true)
	{
		$i18n_text = JText::_($text);
		$class = $this->fetchIconClass($name);
		$doTask = $this->_getCommand($text, $task, $list);

		$html = "<a href=\"#\" onclick=\"$doTask\" class=\"toolbar\">\n";
		$html .= "<span class=\"$class\">\n";
		$html .= "</span>\n";
		$html .= "$i18n_text\n";
		$html .= "</a>\n";

		return $html;
	}

Please Entrar ou Registrar to join the conversation.