I'm trying to alter/patch/hack node_level_blocks
(like the admin blocks overview page) so that some users are restricted in choosing regions for certain blocks. For instance the "New Content" view must always be in the Right region. The normal user can change the weight and add more blocks to that region, but they can't remove that block from that region.
What I did (I'm pretty close):
- Form alter the
<select>
to that it contains only 1 option - Override
Drupal.tableDrag.blocks.onDrag
to fix and improve the standard tableDrag handler and make the row jump back to its forced position
That works, but the user can still drag the block around to regions it doesn't belong. (I don't have a demo online.)
How do I tell tableDrag to NOT let some blocks out of their original regions? I don't understand its 400 options...
Drupal.tableDrag.prototype.row.prototype.isValidSwap()
and "simply" make it returnFALSE
if swap should not be valid. At least that's how I solved my similar issue.