Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

taking out a user error #4

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 7 additions & 7 deletions code/GridFieldGroupable.php
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand All @@ -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'));
Expand All @@ -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
*
Expand All @@ -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()) {
Expand Down Expand Up @@ -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) {
Expand Down