1
|
|
|
<?php |
2
|
|
|
|
3
|
|
|
namespace SilverStripe\Taxonomy; |
4
|
|
|
|
5
|
|
|
use SilverStripe\Admin\ModelAdmin; |
6
|
|
|
use SilverStripe\Forms\GridField\GridField; |
7
|
|
|
use Symbiote\GridFieldExtensions\GridFieldOrderableRows; |
|
|
|
|
8
|
|
|
use SilverStripe\ORM\SS_List; |
9
|
|
|
use UndefinedOffset\SortableGridField\Forms\GridFieldSortableRows; |
|
|
|
|
10
|
|
|
|
11
|
|
|
/** |
12
|
|
|
* Management interface for Taxonomies, TaxonomyTerms and TaxonomyTypes |
13
|
|
|
* |
14
|
|
|
* @package taxonomy |
15
|
|
|
*/ |
16
|
|
|
class TaxonomyAdmin extends ModelAdmin |
17
|
|
|
{ |
18
|
|
|
private static $url_segment = 'taxonomy'; |
|
|
|
|
19
|
|
|
|
20
|
|
|
private static $managed_models = array(TaxonomyTerm::class, TaxonomyType::class); |
|
|
|
|
21
|
|
|
|
22
|
|
|
private static $menu_title = 'Taxonomies'; |
|
|
|
|
23
|
|
|
|
24
|
|
|
private static $menu_icon_class = 'font-icon-tags'; |
|
|
|
|
25
|
|
|
/** |
26
|
|
|
* If terms are the models being managed, filter for only top-level terms - no children |
27
|
|
|
* |
28
|
|
|
* @return SS_List |
29
|
|
|
*/ |
30
|
|
|
public function getList() |
31
|
|
|
{ |
32
|
|
|
if ($this->modelClass === TaxonomyTerm::class) { |
33
|
|
|
$list = parent::getList(); |
34
|
|
|
return $list->filter('ParentID', '0'); |
35
|
|
|
} |
36
|
|
|
return parent::getList(); |
37
|
|
|
} |
38
|
|
|
|
39
|
|
|
public function getEditForm($id = null, $fields = null) |
40
|
|
|
{ |
41
|
|
|
if ($this->modelClass !== TaxonomyTerm::class) { |
42
|
|
|
return parent::getEditForm($id, $fields); |
43
|
|
|
} |
44
|
|
|
|
45
|
|
|
$form = parent::getEditForm($id, $fields); |
46
|
|
|
|
47
|
|
|
/** @var GridField $gf */ |
48
|
|
|
$gf = $form->Fields()->dataFieldByName($this->sanitiseClassName($this->modelClass)); |
49
|
|
|
|
50
|
|
|
// Setup sorting of TaxonomyTerm siblings, if a suitable module is included |
51
|
|
|
if (class_exists(GridFieldOrderableRows::class)) { |
52
|
|
|
$gf->getConfig()->addComponent(GridFieldOrderableRows::create('Sort')); |
53
|
|
|
} elseif (class_exists(GridFieldSortableRows::class)) { |
54
|
|
|
$gf->getConfig()->addComponent(new GridFieldSortableRows('Sort')); |
55
|
|
|
} |
56
|
|
|
|
57
|
|
|
return $form; |
58
|
|
|
} |
59
|
|
|
} |
60
|
|
|
|
The issue could also be caused by a filter entry in the build configuration. If the path has been excluded in your configuration, e.g.
excluded_paths: ["lib/*"]
, you can move it to the dependency path list as follows:For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths