Jump to content

Sort Blocks in the Backend


nurkka
 Share

Recommended Posts

I am trying to sort the blocks in the page editor via "sort" and "sortGroup", but they are still sorted alphabetically.

image.png.7ba9a87b02248077845a3f93aa213480.png

I tried every combination of "group", "groupSort" and "sort" with and without various values, but with no luck.
Does anyone know how to sort the blocks?

Additional question: Is there a feature to copy/clone blocks within the page editor?

Thanks in advance!

Link to comment
Share on other sites

Hey @nurkka thx for your question!

I think that I just changed this as some point in time as I've never really been using the sort feature. It turned out to be less useful than I thought and having them sorted alphabetically with a filter input seemed the better option. I think it should be quite easy though to restore the old behaviour via config setting. Would that help?

Or are you just playing around with it and I can remove that info from the docs?

3 hours ago, nurkka said:

Additional question: Is there a feature to copy/clone blocks within the page editor?

This is unfortunately not possible at the moment 🙈

 

Link to comment
Share on other sites

Thanks @bernhard !

I am using RockPageBuilder for the first time and already in a real client project, which I have to finish until next week 🙂 The project is a small company website with at most six to seven different block types per page. But for the client resp. the person who will be adding new content pages, it would be great, if the blocks had the same order as they are appearing in the layout and on already finished pages.

So it would be great if you could add back the sorting. But if the sorting has unwanted side effects, then it would surely be better to just remove it from the docs ...

Regarding the copy/clone feature: That would be a great addition! I built some websites and also content management backends for onlineshops with RepeaterMatrix, and when I talked to the clients afterwards, the copy mechanism is always something they are using really often. Would be great to have this available also in RockPageBuilder!

Link to comment
Share on other sites

2 minutes ago, nurkka said:

But for the client resp. the person who will be adding new content pages, it would be great, if the blocks had the same order as they are appearing in the layout and on already finished pages.

What do you mean exactly? 🙂 

Link to comment
Share on other sites

Sorry! I meant it would be easier for editor users, if the blocks in the page editor could have the same order as they have initially regarding to the given layout of the page. For example let's say every page always starts with a HeroImage, but the corresponding block would be the fifth in the list of available blocks. So the editors will have to search through the blocks to find the right one to start with, and so on.

Of course, they can move the blocks around. But in my experience, they won't do that. They will always follow the same order of blocks. Therefore, I thought they would benefit from pre-sorted blocks, as they can go through them from left to right.

Or am I misunderstanding something? I meant the sort order of the "create new block of type XY" icons. 🙂 

  • Thanks 1
Link to comment
Share on other sites

Hey @nurkka I have something for you 😎

Please download v5.9.0 https://www.baumrock.com/en/releases/rockpagebuilder/

0oXeNb7.gif

All you have to do is add a hook like this to /site/ready.php:

wire()->addHookAfter(
  'RockPageBuilder::getPresets',
  function (HookEvent $event) {
    $page = $event->arguments(0);
    $field = $event->arguments(1);
    if ($page->template != 'blogitem') return;
    if ($field->name != 'rockpagebuilder_blocks') return;
    $event->return = [
    'Demo' => [
      'Alert',
      'Features',
      'Features',
      'Videos',
    ],
  ];
});

 

  • Like 1
Link to comment
Share on other sites

Hi @bernhard

Thanks a lot - this is really a cool feature!

But I fear we have talked past each other ... because I just meant the sort order of the RockPageBuilder thumbnails, not the order of the already created blocks. I am sorry I didn't realize that, and now you had a lot of work with that - sorry for that!

 

 

 

 

Link to comment
Share on other sites

No, I understood that. But I didn't want to mess with the sort order and thought this would be a better and more powerful solution.

For example let's say you have blocks "Gallery - Hero - Info" (sorted a-z)

But for blog posts, you want editors usually add them in the order "Hero - Info - Gallery"

You can now add a preset called "Default Blog Post" (or anything else) and when the user clicks on that preset it will add blocks in the order "Hero - Info - Gallery"

You could then also add different presets to that page and this would not be possible with your suggested sort feature. For example you could have two presets "Default Blog Post" and "Event Blog Post" or whatever.

  • Thanks 1
Link to comment
Share on other sites

Thanks again, the feature is really cool, and I'll definitely use it!

Also, I am still thinking about the predefined sort order of the block-thumbnails. Is the only way to pre-sort them, to rename them to let's say "01 HeroImage", "02 Button", "03 Accordion" ?

Are the parameters "sort" and "groupSort" used for anything else?

Link to comment
Share on other sites

Hey @nurkka just had a look and totally forgot that I added a setting for that. The reason is to not break existing installations but set a new default for new installations:

0Z3psUG.png

Without that setting sorting will have no effect. Did you check that box?

  • Thanks 1
Link to comment
Share on other sites

Thanks @bernhard !
Embarrasingly, I forgot that I already had seen that option 😰 
Also, I misinterpreted it, because I thought it meant that, if activated, the users would be able to sort the block buttons by themselves ...
Now, it simply works ... I hope the feature won't be removed as it is considered deprecated

Thanks a lot for your help!

Link to comment
Share on other sites

15 hours ago, nurkka said:

Now, it simply works ... I hope the feature won't be removed as it is considered deprecated

Hey @nurkka great we got it working 🙂 I always try my best to not introduce no breaking changes or remove things that are needed. So I encourage everyone to report what they need or use or just ask if anything is unclear or needs to be changed, like you did. I have changed the description of that feature in v5.9.1 and updated the docs to hopefully make things clear: https://www.baumrock.com/en/processwire/modules/rockpagebuilder/docs/blocks/#sorting-and-grouping-blocks

  • Thanks 1
Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...