modxcms / fred

The friendly front-end editor for visual, drag-and-drop content building in MODX CMS
https://fred.modx.com
MIT License
59 stars 25 forks source link

Element Templates Drop-down #390

Closed sottwell closed 4 months ago

sottwell commented 3 years ago

The Element Templates drop-down does not save the selected value on first save. The page refreshes after saving the Element, and the drop-down is empty. Select the Template again, and this time it saves it when the Element is saved again.

I'm not sure what exactly happens if an Element is used without a template being selected, but in any case that's not the expected behavior of a select drop-down.

select-drop-down
sottwell commented 3 years ago

I checked the database, and the modx_fred_element_template_access really isn't there after the first, create, save. It is there after the second, update, save.

sottwell commented 3 years ago

I see that all of the other Fred create and update processors where templates are assigned have an afterSave function that deals with the templates, but the element's create processor does not. I rather imagine this is why the templates field is not saved on first creating a new element.

rthrash commented 3 years ago

This issue has been mentioned on MODX Community. There might be relevant details there:

https://community.modx.com/t/element-templates-drop-down-not-saving/3581/1

sottwell commented 3 years ago

Um... that's my link to this issue.

sottwell commented 3 years ago

I found the "relevant details" in the core/components/fred/processors/mgr/elements/create.class.php, it's missing the afterSave function.