diff --git a/code/GridFieldGroupable.php b/code/GridFieldGroupable.php index b3d28d9..d13a1cc 100644 --- a/code/GridFieldGroupable.php +++ b/code/GridFieldGroupable.php @@ -95,7 +95,7 @@ public static function include_requirements() { Requirements::javascript($moduleDir.'/js/groupable.js'); Requirements::css($moduleDir.'/css/groupable.css'); - + } public function getURLHandlers($grid) { @@ -110,11 +110,11 @@ public function getURLHandlers($grid) { public function getHTMLFragments($field) { if( ! $field->getConfig()->getComponentByType('GridFieldOrderableRows')) { - user_error("GridFieldGroupable requires a GridFieldOrderableRows component", E_USER_WARNING); + return; } - + self::include_requirements(); - + // set ajax urls / vars $field->addExtraClass('ss-gridfield-groupable'); $field->setAttribute('data-url-group-assignment', $field->Link('group_assignment')); @@ -125,7 +125,7 @@ public function getHTMLFragments($field) { $field->setAttribute('data-groupable-groups', json_encode( $this->getOption('groupsAvailable') ) ); } - + /** * Handles requests to assign a new block area to a block item * @@ -135,7 +135,7 @@ public function getHTMLFragments($field) { */ public function handleGroupAssignment($grid, $request) { $list = $grid->getList(); - + // (copied from GridFieldOrderableRows::handleReorder) $modelClass = $grid->getModelClass(); if ($list instanceof ManyManyList && !singleton($modelClass)->canView()) { @@ -170,7 +170,7 @@ public function handleGroupAssignment($grid, $request) { } $this->extend('onAfterAssignGroupItems', $list); - + // Forward the request to GridFieldOrderableRows::handleReorder (if GridFieldOrderableRows) $orderableRowsComponent = $grid->getConfig()->getComponentByType('GridFieldOrderableRows'); if($orderableRowsComponent) {