I am writing a module that enables admins to create entities. One of the fields on the entity is a cut-off date.
For each entity within the cut-off date a block is produced. I do this by means of a EntityFieldQuery
inside hook_block_info
.
The user can then configure those blocks to appear on certain paths.
This approach seems to be working, but I'm a little unsure:
is it safe (i.e. reliable)? I'm unsure how drupal handles all the config for blocks - if the block does not exist any more is its config all deleted?
is it an efficiency nightmare? Currently it's only searching a handful of entities for in-date ones, but I'm interested to know if there could be a more efficient way because I guess this will run for every single page load.
Thanks,