Compare commits

...

4 Commits

Author SHA1 Message Date
UndefinedOffset f6ce5741ab
Added error when a many_many relationship could not be found 2024-05-13 11:21:18 -03:00
UndefinedOffset b1febae3d8
Updated description 2024-01-30 14:45:48 -04:00
UndefinedOffset 9e5908c4ef
Updated description 2024-01-30 14:44:55 -04:00
UndefinedOffset 09f7be61ae
Removed Silverstripe supported badge from the readme 2023-06-16 09:30:10 -03:00
4 changed files with 12 additions and 5 deletions

View File

@ -1,4 +1,4 @@
Copyright (c) 2023, Ed Chipman
Copyright (c) 2024, Ed Chipman
All rights reserved.
Redistribution and use in source and binary forms, with or without modification,

View File

@ -4,15 +4,14 @@ SortableGridField
[![CI](https://github.com/UndefinedOffset/SortableGridField/actions/workflows/ci.yml/badge.svg)](https://github.com/UndefinedOffset/SortableGridField/actions/workflows/ci.yml)
[![Latest Stable Version](https://poser.pugx.org/undefinedoffset/sortablegridfield/version.svg)](http://www.silverstripe.org/stable-download/)
[![Latest Unstable Version](https://poser.pugx.org/undefinedoffset/sortablegridfield/v/unstable.svg)](https://packagist.org/packages/undefinedoffset/sortablegridfield)
[![SilverStripe supported module](https://img.shields.io/badge/silverstripe-supported-0071C4.svg)](https://www.silverstripe.org/software/addons/silverstripe-commercially-supported-module-list/)
[![Total Downloads](https://poser.pugx.org/undefinedoffset/sortablegridfield/downloads.svg)](https://packagist.org/packages/undefinedoffset/sortablegridfield)
[![License](https://poser.pugx.org/undefinedoffset/sortablegridfield/license.svg)](https://github.com/UndefinedOffset/SortableGridField/blob/master/LICENSE)
Adds drag and drop functionality to SilverStripe 4's GridField
Adds drag and drop functionality to Silverstripe's GridField
## Requirements
* SilverStripe 4.11+
* Silverstripe 4.11+ or 5.0+
## Installation

View File

@ -1,6 +1,6 @@
{
"name": "undefinedoffset/sortablegridfield",
"description": "Adds drag and drop functionality to SilverStripe 4.x's GridField",
"description": "Adds drag and drop functionality to Silverstripe's GridField",
"type": "silverstripe-vendormodule",
"keywords": ["silverstripe", "gridfield", "sortable", "sort"],
"license": "BSD-3-Clause",

View File

@ -253,6 +253,10 @@ class GridFieldSortableRows extends AbstractGridFieldComponent implements GridFi
if ($many_many) {
$schema = Injector::inst()->get(DataObjectSchema::class);
$componentDetails = $schema->manyManyComponent(get_class($owner), (!empty($this->custom_relation_name) ? $this->custom_relation_name : $gridField->getName()));
if (empty($componentDetails)) {
user_error('Could not find the relationship "' . (!empty($this->custom_relation_name) ? $this->custom_relation_name : $gridField->getName()) . '" on "' . get_class($owner) . '"', E_USER_ERROR);
}
$parentField = $componentDetails['parentField'];
$componentField = $componentDetails['childField'];
$table = $componentDetails['join'];
@ -483,6 +487,10 @@ class GridFieldSortableRows extends AbstractGridFieldComponent implements GridFi
if ($many_many) {
$schema = Injector::inst()->get(DataObjectSchema::class);
$componentDetails = $schema->manyManyComponent(get_class($owner), (!empty($this->custom_relation_name) ? $this->custom_relation_name : $gridField->getName()));
if (empty($componentDetails)) {
user_error('Could not find the relationship "' . (!empty($this->custom_relation_name) ? $this->custom_relation_name : $gridField->getName()) . '" on "' . get_class($owner) . '"', E_USER_ERROR);
}
$parentField = $componentDetails['parentField'];
$componentField = $componentDetails['childField'];
$table = $componentDetails['join'];