Please excuse me for the title.. I have no idea how to describe my problem better - if someone knows a better description for this question feel free to edit it.
I made a screenshot to clarify what I want to know.. Is it somehow possible to hook a custom option there?
I made an excel export for our customer and I would like to add an "export to excel" button there that sends an ajax request to my controller. Could you please explain me in detail how to do this?
Thank you very much
Edit
So thanks to your answers I created this test (just to see if I can add something)
<?php
namespace Craft;
class SRExcelExport_ExportElementAction extends BaseElementAction
{
/**
* Get element action name.
*
* @return string
*/
public function getName()
{
return Craft::t('Export Files');
}
public function isDestructive()
{
return true;
}
public function performAction(ElementCriteriaModel $criteria)
{
// Remove all the ingredients from the selected elements
$elements = $criteria->find();
foreach ($elements as $element)
{
//do something
}
// Success!
$this->setMessage(Craft::t('success'));
return true;
}
public function getTriggerHtml()
{
$js = 'new Craft.ElementActionTrigger({' .
'handle: '.JsonHelper::encode($this->getClassHandle()).', ' .
'batch: true, ' .
'validateSelection: function($selectedElements){ return true; }, ' .
'activate: function($selectedElements){ alert("Made you click"); }' .
'});';
craft()->templates->includeJs($js);
}
}
With the Plugin Handle SRExcelExport with the folder structure
srexcelexport
--elementactions
-----SRExcelExport_ExportElementAction.php
But nothing happens, the file is ignored, even a die()
in the constructor does nothing. Do I need to do something to "call" the class myself or is there just a stupid error I made? I bet its just an obvious minor error I can't see right now