Issue #1621334 by SebCorbin, poker10, szt, larowlan, swentel, salvis: Notice: Undefined property: stdClass::$forum_tid in forum_node_view()
parent
06438b6ac3
commit
b71063cf23
|
@ -263,7 +263,7 @@ function _forum_node_check_node_type($node) {
|
||||||
* Implements hook_node_view().
|
* Implements hook_node_view().
|
||||||
*/
|
*/
|
||||||
function forum_node_view($node, $view_mode) {
|
function forum_node_view($node, $view_mode) {
|
||||||
if (_forum_node_check_node_type($node)) {
|
if (!empty($node->forum_tid) && _forum_node_check_node_type($node)) {
|
||||||
if ($view_mode == 'full' && node_is_page($node)) {
|
if ($view_mode == 'full' && node_is_page($node)) {
|
||||||
$vid = variable_get('forum_nav_vocabulary', 0);
|
$vid = variable_get('forum_nav_vocabulary', 0);
|
||||||
$vocabulary = taxonomy_vocabulary_load($vid);
|
$vocabulary = taxonomy_vocabulary_load($vid);
|
||||||
|
|
|
@ -210,6 +210,46 @@ class ForumTestCase extends DrupalWebTestCase {
|
||||||
$node->uid = 1;
|
$node->uid = 1;
|
||||||
$node->taxonomy_forums[LANGUAGE_NONE][0]['tid'] = $this->root_forum['tid'];
|
$node->taxonomy_forums[LANGUAGE_NONE][0]['tid'] = $this->root_forum['tid'];
|
||||||
node_save($node);
|
node_save($node);
|
||||||
|
|
||||||
|
// Verify that adding taxonomy_forums reference field to another content
|
||||||
|
// type does not trigger any errors.
|
||||||
|
// Create new content type.
|
||||||
|
$type_name = 'test_' . strtolower($this->randomName());
|
||||||
|
$type = $this->drupalCreateContentType(array('name' => $type_name, 'type' => $type_name));
|
||||||
|
// Create field instance on the bundle.
|
||||||
|
$vocabulary = taxonomy_vocabulary_load(variable_get('forum_nav_vocabulary', 0));
|
||||||
|
$instance = array(
|
||||||
|
'field_name' => 'taxonomy_forums',
|
||||||
|
'entity_type' => 'node',
|
||||||
|
'label' => $vocabulary->name,
|
||||||
|
'bundle' => $type->type,
|
||||||
|
'required' => FALSE,
|
||||||
|
'widget' => array(
|
||||||
|
'type' => 'options_select',
|
||||||
|
),
|
||||||
|
'display' => array(
|
||||||
|
'default' => array(
|
||||||
|
'type' => 'taxonomy_term_reference_link',
|
||||||
|
'weight' => 10,
|
||||||
|
),
|
||||||
|
'teaser' => array(
|
||||||
|
'type' => 'taxonomy_term_reference_link',
|
||||||
|
'weight' => 10,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
);
|
||||||
|
field_create_instance($instance);
|
||||||
|
// Create node and access node detail page.
|
||||||
|
$settings = array(
|
||||||
|
'type' => $type->type,
|
||||||
|
'title' => $type_name,
|
||||||
|
'taxonomy_forums' => array(LANGUAGE_NONE => array()),
|
||||||
|
);
|
||||||
|
$node1 = $this->drupalCreateNode($settings);
|
||||||
|
$this->drupalGet('node/' . $node1->nid);
|
||||||
|
$this->assertResponse(200);
|
||||||
|
// Remove the field instance.
|
||||||
|
field_delete_instance($instance);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
Loading…
Reference in New Issue