2

Is there a way to change order of blocks before page load (according to current node id for expample)? In hook_preprocess_page or something like that? I don't want to use any modules for this.

1

You can use hook_block_list_alter to achieve this. Be aware that the $block->weight attribute won't be affected at this point in the proceedings, but there are solutions in the comments to this problem.

  • It means that order of blocks in hook_block_list_alter(&$blocks) function can be changed simply by resorting blocks in &$blocks array, right? Thx. – Incredible Dec 1 '15 at 15:42

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.