Update 23 September: I’ve been doing a bit of feature work on my module Block Inject. If you don’t know about the module yet, please see below what it does - there’s a screencast and everything.
This release makes Block Inject the most powerful it has ever been. If you are unhappy with the default placement of the injected region (middle of the body field), you can specify a number of paragraphs as an offset in any direction you want (up or down) to move it - on an individual node basis. Basically you now have the power to adjust it according to the content in that node.
The exceptions overview now includes information on the offset you have for individual nodes. It tells you whether the exception stops the injection or if it doesn't, how many paragraphs it is offset by.
Additionally, I fixed a couple of reported bugs, one of which now making it possible to use Block Inject on multilingual sites as well. It works both with the core translation solution and the Entity Translation module (which is the recommended approach).
So give it a try and let me know if you encounter any problems.
What I did in the 7.x-1.1 release was added the possibility to override the block region being injected into individual nodes. This means that if you set up a region to be injected in all the nodes of a type, you can then manually override this individually for each node. Let’s say if you are writing an article in which you do not want the injected block to appear, all you have to do is check a box.
To manually override this you have to edit a node and under the Publishing options you will see another checkbox: Remove the Block Inject effect on this node. If you tick this box and save the node, the region won’t be injected into this node. Naturally this checkbox will only be available for the content types for which there is a region to be injected.
Additionally, you get an overview page at
admin/structure/block-inject/exceptions where you can see all the nodes for which the injection is exempted.
This new feature adds a bit more flexibility to the use of the module. Now you have the option that if for some reason a piece of content does not need the injection, you can prevent this from happening and know that for the rest of the nodes all is copacetic.
The alternative to this would have had you edit the block assigned to the injected region and set it to not display on a particular node page. But what if you have 3 blocks in the region and you need to stop them from showing on 15 nodes over time? With the new feature, everything is controlled at the node edit level and you also get an overview of which nodes are exempted from injection.
I want to work a bit more on making Block Inject even more flexible by allowing the site administrator to select into which text fields of a content type should the region be injected. Currently it goes into the body field by default but if your main text body is located in a custom field, the module won’t help you. So this will be a next step.
Probably after that, I will make it possible to override the placement of the injected region per node. Currently the default is in the middle of the node body field. This is done by calculating the number of paragraphs (
<p>) and injecting it half way. However, it would be good to allow the content editor to move it up or down a couple of paragraphs for individual nodes if the situation requires it. Come to think of it, I might even work on this next :)
So if you can, test it out and fire up the issue queue with bugs and problems you may have - after all, the module is still in its alpha stage.
Block Inject - What Is It?
Block Inject is a simple module that lets you create custom block regions that get inserted automatically in the middle of all the nodes of a certain type. The idea for it stems from a previous article of mine in which I talked about how you can add content in the middle of the node body field.
It is very simple to use: you create a region to which you assign one or more node types. Then, you add blocks to that region with whatever content you want. These blocks will then appear in the middle of all the node bodies of the content type you assigned to that particular region. There is also a fail-safe: if the body field does not contain at least 2 paragraphs, no blocks get injected. Pretty cool and simple.
And of course, you can individually overwrite some things in the block configuration - for instance make the block display only for certain roles, on certain paths etc.
So do check it out, test it, let me know if you find any bugs or something.
Thanks a lot!