1

I'm attempting to reorder blocks. I understand that it can be done by dragging and dropping on the block structure page, however I have a limitation.

When saving, the order isn't saved. This is most likely because there is a very large number of blocks and the server can't handle that many inputs in one form. So it just reverts to it's original position. I do not have access to the server so I'm unable to make the changes to allow the server to handle that many inputs. I also do not have access to the mySQL database.

I'd like to be able to change the weight manually within the block, but weight is not a field I can edit when attempting to edit that specific block.

Is there a way to add this field? Or is there another possible way to perform this action?

  • The weight is in the database on the block-table. (In fact one block can have multiple rows, one for each theme.) Does it have to be done in the Drupal UI? – Neograph734 May 5 '16 at 14:36
  • I don't have access to the mySQL database either. – Matt May 5 '16 at 14:37
  • Does it work when you toggle the weight field on the block overview page? At the right top of the block page there is a Show row weights link to toggle drag-drop and the weight field. – Neograph734 May 5 '16 at 14:39
  • It does not. I get the same result. Is there a way to toggle the show row weight within one block, so I don't have to submit the weight for every single block at once? – Matt May 5 '16 at 14:40
1

you can do it by using context name in hook_context_load_alter() and tweak it.

/** * Implementation of hook_context_load_alter() */ function mymodule_context_load_alter(&$context) { if ($context->name == 'my_context_name_from_the_ui') { $context->reactions['block']['blocks']['my_block_name']['weight'] = -99; } }

0

This is a very hacky way to do it but I managed to achieve my goal. Through the dev tools on my browser I removed the html of every row of the block table except for the block I wanted to edit. I then changed the weight and submitted.

This worked since only one input was being submitted instead of over 1000

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.