2011-12-15 98 views
1

我想在Drupal 7加几节到用户配置文件下:如何将内容添加到Drupal 7中的用户个人资料页面?

<div class="profile" typeof="sioc:UserAccount" about="/drupal/user/1">

我加入三个新的章节,但问题是,虽然我使用相同添加三个部分的方法,其中只有一个被渲染为上面的div的子元素,而另外两个渲染为兄弟元素。我究竟做错了什么?

这是我如何创建内容:

function plan_user_user_view($account) {  
//Create the markup for the events region 
$account->content['events'] = array(
    '#type' => 'user_profile_item', 
    '#theme' => 'events', 
    '#events' => $events); 

//Create the region for the venues 
    $account->content['venues'] = array(
    '#type' => 'user_profile_item', 
    '#theme' =>'venues', 
    '#userid' => $user->uid, 
    '#venues' => $venues); 

    //Create the region for creating an event 
    $account->content['creator'] = array(
    '#prefix' => '<div class="user-event-item" id="quick-event-creator">', 
    '#suffix' => '</div>', 
    '#type' => 'user_profile_item', 
    '#title' => t('QUICK EVENT CREATOR'), 
    '#markup' => drupal_render(drupal_get_form('event_creation'))); 
} 

此外,有没有更好的方法来创建最后一块的内容呢?其他两个在模板文件中看起来不错,但是最后一个是因为它是一个表单,我想知道是否有更好的方法来做到这一点。

感谢,

回答

0

也许你应该对这个项目profil2这是content_profil的为Drupal 6接班人有了它,你就可以添加信息到用户异型材,如果你想编写自定义看看领域应该是一个很好的起点。

最好。

0

如何:

// Create the category. 
$account->content['mymodule'] = array(
    '#type' => 'user_profile_category', 
    '#title' => t('My module content'), 
); 

// Create first item (child). 
$account->content['mymodule']['events'] = array(
    '#type' => 'user_profile_item', 
    '#title' => t('Events'), 
    '#markup' => t('Whatever'), 
); 

// Create second item (child). 
$account->content['mymodule']['venues'] = array(
    '#type' => 'user_profile_item', 
    '#title' => t('Venues'), 
    '#markup' => t('Whatever'), 
); 

等。底线是user_profile_item项目应该是user_profile_category项目的子项。