signalpoint / DrupalGap

An application development kit for Drupal websites.
https://www.drupalgap.org
GNU General Public License v2.0
232 stars 185 forks source link

Block build alter permanently alters the block #989

Open signalpoint opened 6 years ago

signalpoint commented 6 years ago

The thing to remember with hook_blocks_build_alter() is as it stands the alterations you make to the block are permanent, i.e. as you navigate to the next page, the alterations you made on the previous page are still there, this is obviously no good.

It seems then the problem is DG8 is altering the one and only block in memory, instead of re-instantiating a new one. We probably aren't using classes with dg8 blocks, and hence our struggle with dealing with the global dg.blocks, which needs to be renamed to dg._blocks btw.

Oh what a mess. But if you clean this app, altering block attributes will be easy as pie, so f'in do it.