Calling all prescients (inserting a block into a node for Drupal 7)

Events happening in the community are now at Drupal community events on www.drupal.org.
Screenack's picture

There are various ways to insert a block into a node in D6: "insert block" and "RepTag" (and directly via a php insert, which I've disabled for security reasons) Neither are showing the promise of D7 support. What alternatives might you suggest that will remain relevant going forward?

Comments

If you really need this

afreeman's picture

If you really need this functionality and adding a block region to your theme isn't sufficient my suggestion would be to port a copy of whatever module you're currently using to D7 and then submit a patch back to the project.

Block region

Screenack's picture

A block region in the template isn't relevant to this use case. For example: a search block insert into a node, or a repeating block of text that appears arbitrarily.

I'd love to port one of the modules listed myself (not sure the maintainers would be as enthusiastic with my php) but I was curious if there were alternatives I simply haven't considered.

Much thanks!

This is sort of a moot point

sheena_d's picture

This is sort of a moot point in D7. In D7, the node content is a block and can be moved around to different regions just like any other piece of content, and thus there is no need for a way to insert a block into node content.

Ooh, I like

Screenack's picture

That might also explain why there was "lack" of support for said modules. I have used the "insert block" and its working perfectly. Much thanks!

Are you talking about

kwinters's picture

Are you talking about inserting a block between CCK fields? So it might look something like [address] [google map block] [driving directions cck textarea].

If that's the case, it seems like you'd want a "block reference" in the same way you might have a node or user reference CCK field.

Inserting it inside of a single textarea is a bigger issue, and I'd say just try and avoid that.

Ken Winters

Yea

Screenack's picture

No, it's "slipped" into a content stream.

I see your point and conceptually agree. I had considered making the block a div that appropriately clears content, but it's use case is so narrow, that this was a quicker solution. (I'm guessing the customer will change this requirement anyone once they get a better sense, via experience, of what a CMS offers)

Thanks!

Thanks for the tip on block

Yura Filimonov's picture

Thanks for the tip on block reference.

For the record, there are many ways to insert a block in a field, including Insert Block and Fixed Field.

I've been looking for a way to insert a block as a field into nodes of a specific taxonomy term and going with block reference seems to be the closest match.

The alternative was to use Context to place a block on those taxonomy-related pages, but outside the field flow (I need a block inside the main content area, floated right).

If anyone knows something better, please let me know :)

Thanks.

Beans, Views, and EntityReference

cgmonroe's picture

If you want to start doing stuff the D8 way, you should look at the EntityReference and Bean projects.

The Bean project is what D8 is loosely basing it's "Blocks as Entities" changes on.

Basically beans let you create "block types" similar to content types. So a bean block can have fields like all entities. This means you could add a taxonomy field to a bean block and use a contextual filter on a view to find all bean blocks related to the displayed page.

Or use an entityreference field in a content type to associate specific beans with a page.

Another possible way to display a smaller set of standard Drupal blocks based on a nodes taxonomy might be to use the Context module with the context_entity_field module. This lets you set a condition based on node field values. But is a semi static set of rules.

triDUG

Group organizers

Group notifications

This group offers an RSS feed. Or subscribe to these personalized, sitewide feeds: