我定义了两个 profile2 配置文件 - main 和 customer_profile。另外,我有一个名为 Customer 的节点类型。
创建新的客户节点时,我想加载custom_profile表单。这个想法是同时创建一个节点和一个配置文件。
我知道这绝对是一个 hook_form_alter 解决方案,但有人可以告诉我如何在创建或编辑客户节点时以编程方式加载配置文件。
最佳答案
您可以使用这些函数加载配置文件类型和数据
$types = profile2_get_types();
profile2_load_by_user($account, $type_name = NULL)
例如:
$types = profile2_get_types();
if (!empty($types)) {
foreach ($types as $type) {
$profile = profile2_load_by_user($uid, $type->type);
}
}
关于drupal-7 - Drupal 7 以编程方式加载配置文件2,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/9548116/