This question has been answered by BobRay. See the first response.
<?php
if ($resource->get('isfolder')) {
$resource->set('isfolder', false);
$resource->save();
}
That was the default behavior in Evolution, but it wasn't true of Revo for a long time. There should be a System Setting for it, imo (maybe there is, but I couldn't find one).
The only easy solution I can think of would be a plugin connected to OnDocFormSave that would prevent anything from being a container. I'm not sure it would work and it might not meet your needs, but here it is:
<!--?php if ($resource--->get('isfolder')) { $resource->set('isfolder', false); $resource->save(); }
public function afterSave() {
$this->object->addLock();
$this->setParentToContainer();
$this->saveResourceGroups();
$this->checkIfSiteStart();
return parent::afterSave();
}<?php
if ($mode !== modSystemEvent::MODE_NEW) return;
$parent = $resource->getOne('Parent');
if ($parent) {
$parent->set('isfolder', false);
$parent->save();
}The change is in the resource/create processor's afterSave() event.
public function afterSave() { $this->object->addLock(); $this->setParentToContainer(); $this->saveResourceGroups(); $this->checkIfSiteStart(); return parent::afterSave(); }
Since it's the parent's isfolder value that needs changing, the code should be (attached to OnDocFormSave):
<!--?php if ($mode !== modSystemEvent::MODE_NEW) return; $parent = $resource--->getOne('Parent'); if ($parent) { $parent->set('isfolder', false); $parent->save(); }
I tested it and it works. Although the parent resource is still shown as a folder in the tree, its 'isfolder' field is not set so it's not a container. The plugin only executes for new docs, so you can still set the "Container" checkbox when updating an existing resource.