Skip to content
Snippets Groups Projects
Commit 79a627fa authored by Ghislain Loas's avatar Ghislain Loas
Browse files

upgrade buttons : improve button behavior

parent acf5ad2b
Branches
Tags
4 merge requests!2334Master,!2102#57574 : correction orthographe des jours de la semaine,!2078Sandbox upgrade form buttons,!2066Sandbox upgrade form buttons
Pipeline #730 failed with stage
in 20 minutes and 36 seconds
......@@ -21,18 +21,34 @@
class ZendAfi_View_Helper_Button extends ZendAfi_View_Helper_BaseHelper {
public function button($instance) {
if(!$instance)
public function button($button) {
if(!$button)
return '';
if(!isset($instance->getAttribs()['onclick']))
$instance->setAttribs(array_merge($instance->getAttribs(),
['data-url' => $instance->getUrl()]));
$this->_setDefaultAttribs($button);
return $this->_tag('button',
implode([$instance->getImage(),
$instance->getText()]),
$instance->getAttribs());
implode([$button->getImage(),
$button->getText()]),
$button->getAttribs());
}
protected function _setDefaultAttribs($button) {
if(isset($button->getAttribs()['onclick']))
return $button;
$button->setAttribs(array_merge($button->getAttribs(),
['data-url' => $button->getUrl()]));
if($this->view->isPopup())
return $button;
return $button->setAttribs(array_merge($button->getAttribs(),
['onclick' => sprintf('window.location = \'%s\'',
$button->getUrl())]));
}
}
?>
\ No newline at end of file
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment