mirror of
https://github.com/colymba/GridFieldBulkEditingTools.git
synced 2024-10-22 11:05:57 +02:00
API: added forbidden filed classes
Some fields classes break the component. These have been added to a forbidden list and cannot be removed from the blacklist.
This commit is contained in:
parent
c916d6ac12
commit
b8a0a1e14f
@ -20,11 +20,17 @@ class GridFieldBulkImageUpload implements GridField_HTMLProvider, GridField_URLH
|
||||
protected $config = array(
|
||||
'imageFieldName' => null,
|
||||
'editableFields' => null,
|
||||
'fieldsClassBlacklist' => array( 'GridField', 'UploadField' ),
|
||||
'fieldsClassBlacklist' => array(),
|
||||
'fieldsNameBlacklist' => array(),
|
||||
'folderName' => 'bulkUpload'
|
||||
);
|
||||
|
||||
/**
|
||||
* Holds any class that should not be used as they break the component
|
||||
* These cannot be removed from the blacklist
|
||||
*/
|
||||
protected $forbiddenFieldsClasses = array( 'GridField', 'UploadField' );
|
||||
|
||||
/**
|
||||
*
|
||||
* @param string $imageField
|
||||
@ -34,6 +40,9 @@ class GridFieldBulkImageUpload implements GridField_HTMLProvider, GridField_URLH
|
||||
{
|
||||
if ( $imageField != null ) $this->setConfig ( 'imageFieldName', $imageField );
|
||||
if ( $editableFields != null ) $this->setConfig ( 'editableFields', $editableFields );
|
||||
|
||||
//init classes blacklist with forbidden classes
|
||||
$this->config['fieldsClassBlacklist'] = $this->forbiddenFieldsClasses;
|
||||
}
|
||||
|
||||
/**
|
||||
@ -50,6 +59,13 @@ class GridFieldBulkImageUpload implements GridField_HTMLProvider, GridField_URLH
|
||||
{
|
||||
$value = array($value);
|
||||
}
|
||||
|
||||
//makes sure $forbiddenFieldsClasses are in no matter what
|
||||
if ( $reference == 'fieldsClassBlacklist' )
|
||||
{
|
||||
$value = array_unique( array_merge($value, $this->forbiddenFieldsClasses) );
|
||||
}
|
||||
|
||||
$this->config[$reference] = $value;
|
||||
}
|
||||
}
|
||||
@ -111,7 +127,7 @@ class GridFieldBulkImageUpload implements GridField_HTMLProvider, GridField_URLH
|
||||
*/
|
||||
function removeClassFromBlacklist ( $className )
|
||||
{
|
||||
if (key_exists($className, $this->config['fieldsNameBlacklist'])) {
|
||||
if (key_exists($className, $this->config['fieldsNameBlacklist']) && !in_array($className, $this->forbiddenFieldsClasses)) {
|
||||
return delete( $this->config['fieldsNameBlacklist'][$className] );
|
||||
}else{
|
||||
return false;
|
||||
|
Loading…
Reference in New Issue
Block a user