API bulk action names are case sensitive FIX #75

This commit is contained in:
Thierry François 2014-09-06 14:13:38 +03:00
parent 1010c9be6f
commit f4f0ac096e
3 changed files with 12 additions and 14 deletions

View File

@ -20,8 +20,8 @@ class GridFieldBulkActionEditHandler extends GridFieldBulkActionHandler
* @var array
*/
private static $url_handlers = array(
'bulkedit/update' => 'update',
'bulkedit' => 'edit'
'bulkEdit/update' => 'update',
'bulkEdit' => 'edit'
);
@ -46,7 +46,7 @@ class GridFieldBulkActionEditHandler extends GridFieldBulkActionHandler
->setAttribute('id', 'bulkEditingUpdateBtn')
->addExtraClass('ss-ui-action-constructive cms-panel-link')
->setAttribute('data-icon', 'accept')
->setAttribute('data-url', $this->gridField->Link('bulkaction/bulkedit/update'))
->setAttribute('data-url', $this->gridField->Link('bulkaction/bulkEdit/update'))
->setUseButtonTag(true)
->setAttribute('src', '')//changes type to image so isn't hooked by default actions handlers
);

View File

@ -6,13 +6,13 @@
* @package GridFieldBulkEditingTools
* @subpackage BulkManager
*/
class GridFieldBulkActionUnlinkHandler extends GridFieldBulkActionHandler
class GridFieldBulkActionUnLinkHandler extends GridFieldBulkActionHandler
{
/**
* RequestHandler allowed actions
* @var array
*/
private static $allowed_actions = array('unlink');
private static $allowed_actions = array('unLink');
/**
@ -20,7 +20,7 @@ class GridFieldBulkActionUnlinkHandler extends GridFieldBulkActionHandler
* @var array
*/
private static $url_handlers = array(
'unlink' => 'unlink'
'unLink' => 'unLink'
);
@ -30,7 +30,7 @@ class GridFieldBulkActionUnlinkHandler extends GridFieldBulkActionHandler
* @param SS_HTTPRequest $request
* @return SS_HTTPResponse List of affected records ID
*/
public function unlink(SS_HTTPRequest $request)
public function unLink(SS_HTTPRequest $request)
{
$ids = $this->getRecordIDList();
$this->gridField->list->removeMany($ids);

View File

@ -47,7 +47,7 @@ class GridFieldBulkManager implements GridField_HTMLProvider, GridField_ColumnPr
if ( $defaultActions )
{
$this->config['actions'] = array(
'bulkedit' => array(
'bulkEdit' => array(
'label' => _t('GRIDFIELD_BULK_MANAGER.EDIT_SELECT_LABEL', 'Edit'),
'handler' => 'GridFieldBulkActionEditHandler',
'config' => array(
@ -56,9 +56,9 @@ class GridFieldBulkManager implements GridField_HTMLProvider, GridField_ColumnPr
'isDestructive' => false
)
),
'unlink' => array(
'unLink' => array(
'label' => _t('GRIDFIELD_BULK_MANAGER.UNLINK_SELECT_LABEL', 'UnLink'),
'handler' => 'GridFieldBulkActionUnlinkHandler',
'handler' => 'GridFieldBulkActionUnLinkHandler',
'config' => array(
'isAjax' => true,
'icon' => 'chain--minus',
@ -203,11 +203,9 @@ class GridFieldBulkManager implements GridField_HTMLProvider, GridField_ColumnPr
{
if ( array_key_exists($name, $this->config['actions']) )
{
user_error("Bulk action $name already exists.", E_USER_ERROR);
user_error("Bulk action '$name' already exists.", E_USER_ERROR);
}
$name = strtolower($name);
if ( !$label )
{
$label = ucfirst($name);
@ -255,7 +253,7 @@ class GridFieldBulkManager implements GridField_HTMLProvider, GridField_ColumnPr
{
if ( !array_key_exists($name, $this->config['actions']) )
{
user_error("Bulk action $name doesn't exists.", E_USER_ERROR);
user_error("Bulk action '$name' doesn't exists.", E_USER_ERROR);
}
unset( $this->config['actions'][$name] );