Posted by jmm42 on January 31, 2013 at 5:43pm
How does Drupal render 'render elements':
$account->content['example'] = array( {renderable array information on the t('Content')} ); (#1)
$account->content['example']['output'] = array( {renderable array information on the $content} ) (#2)
Where does drupal pass render elements to 'drupal_render()'?
Below is the entire hook function that contains the two render elements (#1), and (#2).
- - -
<?php
function example_user_view($account, $build_mode) {
if (!user_access('view content creation permissions')) {
return;
}
$node_types = node_permissions_get_configured_types();
if (empty($node_types) {
return;
}
$list = array();
foreach ($node_types as $type) {
if (user_access('create' . $type . ' content', $account)) {
$list[] = check_plain(node_type_get_name($type));
}
}
if (!empty($list)) {
$variables = array (
'items' => $list,
);
}
$content = theme('item_list', $variables);
if (!isset($account->content['example'])) {
$account->content['example'] = array();
}
$account->content['example'] += array (
'#type' => 'user_profile_category',
'#attributes' => array('class' => array('user-member')),
'#weight' => 5,
'#title' => t('Content'),
);
$account->content['example']['output'] = array (
'#type' => 'user_profile_item',
'#title' => t('Content creation permissions'),
'#markup' => $content,
'#attributes' => array('class' => array('content-creation')),
);
}
?>
Comments
'user_build_content()'
'user_build_content()' invokes 'example_user_view()':
module_invoke_all('user_view', $account, $view_mode, $langcode);
- http://api.drupal.org/api/drupal/modules!user!user.module/function/user_build_content/7
But, after drupal modifies the '$account' object - within 'example_user_view()' - somewhere down the road, Drupal applies 'drupal_render()' on the two render elements. Could someone tell me what file / function handles this rendering process?
Solution: Found
I was in IRC just a moment ago, and determined my solution: