Issue 15189

Decide how a module should produce blocks to visually allocate the content.

15189
Reporter: bko
Assignee: bko
Type: SubTask
Summary: Decide how a module should produce blocks to visually allocate the content.
Priority: Major
Resolution: Done
Status: Closed
Created: 2014-02-24 15:26:12.542
Updated: 2014-06-25 12:10:27.376
Resolved: 2014-04-14 12:36:06.926
        
Description: There are content-type-specific layout presentation that allocates node fields according to $node->type.

For now although technically it is possible to put fields into a block, it is required that CSS class and target HTML to decided for the module developer to "visually" show the block.

This task is created because the tools catalogue is dependent on this decision.]]>
    


Author: bko@gbif.org
Created: 2014-04-14 12:36:00.206
Updated: 2014-04-14 12:36:00.206
        
There are two ways of doing this:

1. For now when we need to place a certain content piece, we do:
 1) Write a new helpful function that accepts $node/$block/$term object and return the prepared content in renderable array or ready-to-print format;
 2) In corresponding preprocess hooks, depending on the level and targeted template, insert a new variable with the returned value of the newly-written function;
 3) In the template we then only need to print/render that new variable.

The rule of thumb: if we need more then one line of php code to have content inserted in the template, then it's probably better to write that in function and preprocess hooks. This helps keeping similar logic at one place, rather than spreading the same logic across similar templates.

2. Theoretically we could also do that via hook_block_info() and hook_block_view() with similar approach. We could write a same function and return the renderable array to the $block object in hook_block_view(). Given the current layout components, implementing this via block doesn't seem to give any advantage over the first one.

By having this explained, this issue can be closed.