Skip to content

Commit

Permalink
Fix classes used by property sets (#15372)
Browse files Browse the repository at this point in the history
  • Loading branch information
theboxer committed Feb 5, 2021
1 parent 25239b0 commit 652d21e
Show file tree
Hide file tree
Showing 6 changed files with 14 additions and 35 deletions.
35 changes: 7 additions & 28 deletions core/src/Revolution/Processors/Element/GetClasses.php
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@


use MODX\Revolution\modClassMap;
use MODX\Revolution\modElement;
use MODX\Revolution\Processors\Processor;

/**
Expand All @@ -31,7 +32,7 @@ public function checkPermissions()
public function initialize()
{
$this->setDefaultProperties([
'limit' => 10,
'limit' => 0,
'start' => 0,
'sort' => 'class',
'dir' => 'ASC',
Expand All @@ -42,36 +43,14 @@ public function initialize()

public function process()
{
$this->modx->deprecated('2.1.4', 'Please use $modx->getDescendants($className) now.',
'modElementGetClassesProcessor support');
$classes = $this->modx->getDescendants(modElement::class);

$limit = $this->getProperty('limit', 10);
$isLimit = !empty($limit);

/* build query */
$c = $this->modx->newQuery(modClassMap::class);
$c->where([
'parent_class' => 'modElement',
'class:!=' => 'modTemplate',
]);
$c->sortby($this->getProperty('sort'), $this->getProperty('dir'));
$name = $this->getProperty('name', '');
if (!empty($name)) {
$c->where([
'modClassMap.name:IN' => is_string($name) ? explode(',', $name) : $name,
]);
}
if ($isLimit) {
$c->limit($limit, $this->getProperty('start'));
}
$classes = $this->modx->getCollection(modClassMap::class, $c);

/* iterate */
$list = [];
/** @var modClassMap $class */

foreach ($classes as $class) {
$el = ['name' => $class->get('class')];
$list[] = $el;
if ($class === 'MODX\\Revolution\\modScript') continue;

$list[] = ['name' => $class];
}

return $this->outputArray($list);
Expand Down
2 changes: 1 addition & 1 deletion manager/assets/modext/widgets/element/modx.panel.plugin.js
Original file line number Diff line number Diff line change
Expand Up @@ -292,7 +292,7 @@ MODx.panel.Plugin = function(config) {
xtype: 'modx-panel-element-properties'
,elementPanel: 'modx-panel-plugin'
,elementId: config.plugin
,elementType: 'modPlugin'
,elementType: 'MODX\\Revolution\\modPlugin'
,record: config.record
}],{
id: 'modx-plugin-tabs'
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -354,8 +354,8 @@ Ext.extend(MODx.window.AddElementToPropertySet,MODx.Window,{
}
,onElementSelect: function(cb) {
var ec = Ext.getCmp('modx-combo-element-class');
if (ec.getValue() == '') {
ec.setValue('modSnippet');
if (ec.getValue() === '') {
ec.setValue('MODX\\Revolution\\modSnippet');
}
}
});
Expand Down Expand Up @@ -406,7 +406,7 @@ MODx.combo.Elements = function(config) {
,url: MODx.config.connector_url
,baseParams: {
action: 'Element/GetListByClass'
,element_class: 'modSnippet'
,element_class: 'MODX\\Revolution\\modSnippet'
}
});
MODx.combo.Elements.superclass.constructor.call(this,config);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -248,7 +248,7 @@ MODx.panel.Snippet = function(config) {
xtype: 'modx-panel-element-properties'
,elementPanel: 'modx-panel-snippet'
,elementId: config.snippet
,elementType: 'modSnippet'
,elementType: 'MODX\\Revolution\\modSnippet'
,record: config.record
}],{
id: 'modx-snippet-tabs'
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -287,7 +287,7 @@ MODx.panel.Template = function(config) {
,collapsible: true
,elementPanel: 'modx-panel-template'
,elementId: config.template
,elementType: 'modTemplate'
,elementType: 'MODX\\Revolution\\modTemplate'
,record: config.record
}],{
id: 'modx-template-tabs'
Expand Down
2 changes: 1 addition & 1 deletion manager/assets/modext/widgets/element/modx.panel.tv.js
Original file line number Diff line number Diff line change
Expand Up @@ -323,7 +323,7 @@ MODx.panel.TV = function(config) {
,itemId: 'panel-properties'
,elementPanel: 'modx-panel-tv'
,elementId: config.tv
,elementType: 'modTemplateVar'
,elementType: 'MODX\\Revolution\\modTemplateVar'
,record: config.record
}],{
id: 'modx-tv-tabs'
Expand Down

0 comments on commit 652d21e

Please sign in to comment.