[development] Node Rendering Debate
Richard Morse
remorse at partners.org
Fri Jun 22 12:32:49 UTC 2007
On Jun 21, 2007, at 10:10 PM, Derek Wright wrote:
>
> On Jun 21, 2007, at 6:42 PM, Jeff Eaton wrote:
>
>> It is a tremendously powerful system. We shouldn't jump into using
>> it unawares, but we would also be missing a huge opportunity to
>> pass up this system of storing meta-data rich structures and
>> renderable content.
>
> [snip]
> Jeff already added a section on "node structuring" to the DrupalCon
> agenda in September. We both agree that giving this proper thought
> and doing it completely and early in D7 is the best course of action.
>
> Active >> Postponed
When this is discussed, one thing that would be nice to think about
is whether this could be leveraged to fix the problem with input
filters. Specifically, that input filters don't get any context
(such as a node object), so the most useful ones have to implement
themselves via hook_nodeapi() (cf inline.module).
If drupal_render is going to be called on nodes to render them, we
could do something like:
$node['content']['my_field'] = array(
'#value' => $node['my_module']['my_data'],
'#filter' => $node['my_module']['filter'],
);
Which when rendered would generate call the input filters, but be
able to give them the context of the node.
We could even support something like
$node['content']['my_field'] = array(
'#value' => 'This is my @interesting text',
'#keys' => array('@interesting' => '<b>special</b>'),
'#filter' => get_filter('default'),
);
Or, if you wanted to be even more interesting,
$node['content']['my_field'] = array(
'first_part' => array(
'#value' => 'This is, after all, ',
'#filter' => 1,
),
'middle_part' => array(
'#value' => '<blink>not</blink>',
'#filter' => 0,
),
'end_part' => array(
'#value' => ' rocket science; is it?',
'#filter' => get_filter('php'),
),
);
If done right, this could entirely eliminate the need to call
check_plain and check_markup as well...
But the key point is that if we use '#filter', we could get a context
object to input filters, and that would make many input filters
easier to create.
Ricky
The information transmitted in this electronic communication is intended only for the person or entity to whom it is addressed and may contain confidential and/or privileged material. Any review, retransmission, dissemination or other use of or taking of any action in reliance upon this information by persons or entities other than the intended recipient is prohibited. If you received this information in error, please contact the Compliance HelpLine at 800-856-1983 and properly dispose of this information.
More information about the development
mailing list