1

I'm wanting to have the order of my elements within a template dynamic so that the user whilst in a template of page can reorder the modules as they please.

See screenshot for example

enter image description here

Within the entries of the home page where I am editing content, could I reorder the "Hero Detail Body" to appear above the "Hero Detail Heading"?

My initial thoughts were no as within the Sections site, the components display order are defined for the template / tab there.

Is this possible?

2

Correct, there's no way out of the box to reorder fields on the fly in the Entry editor. If you're comfortable with Craft plugin development though I'm sure it's possible to extend Craft and add the ability to do what you want to do. It's also possible that someone has already developed a plugin that achieves this but I personally don't know of any off the top of my head.

However, it seems in your case that if you want to be able to rearrange fields in the Entry editor, your best solution is to put those fields inside a Matrix field. When you have created several fields inside a Matrix field, those "sub-fields" are then arrangeable in whichever order you prefer in the Entry editor. If you've never used Matrix fields before, here's the documentation link so you can read up on it: https://craftcms.com/docs/matrix-fields

Another alternative would be to use the Neo field - if you decide to use Neo, you can just reference your currently existing fields and then add only the Neo field to the page.

Hopefully that helps to answer your question. Cheers!

| improve this answer | |
  • Man thanks @Jalen Davenport for the comment and links. – Filth Feb 26 '18 at 16:11
  • Definitely. Let me know if you have any questions @Filth! – Jalen Davenport Feb 26 '18 at 16:13
1

I'm not sure if there is already a plugin for that but you can create one. It's not that hard because you can re-arrange the field layout in the cp.entries.edit hook

craft()->templates->hook(
    'cp.entries.edit',
    function(&$context) {
        $layout = craft()->fields->getLayoutById(id of your new field layout);
        $context['section']->getEntryTypes()[0]->fieldLayout = $layout;
    }
);

You can create a form to save a new field Layout based on the old one and stores those values in a custom database table. Based on the old field layout Id you'll return a new one for the correct user

| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.