Issue #1715458 by dawehner, damiankloip: Replace calls to ->title with label().
parent
51f953e2fd
commit
02a35e24f6
|
@ -31,7 +31,7 @@ class PluginStyleJumpMenuTest extends ViewsSqlTest {
|
|||
$this->nodes['story'][] = $this->drupalCreateNode(array('type' => 'story'));
|
||||
$this->nodes['story'][] = $this->drupalCreateNode(array('type' => 'story'));
|
||||
|
||||
$this->nodeTitles = array($this->nodes['page'][0]->title, $this->nodes['page'][1]->title, $this->nodes['story'][0]->title, $this->nodes['story'][1]->title);
|
||||
$this->nodeTitles = array($this->nodes['page'][0]->label(), $this->nodes['page'][1]->label(), $this->nodes['story'][0]->label(), $this->nodes['story'][1]->label());
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -48,7 +48,7 @@ class UserTestCase extends ViewsSqlTest {
|
|||
$expected = array();
|
||||
for ($i = 0; $i <= 1; $i++) {
|
||||
$expected[$i] = array(
|
||||
'node_title' => $this->nodes[$i]->title,
|
||||
'node_title' => $this->nodes[$i]->label(),
|
||||
'users_uid' => $this->nodes[$i]->uid,
|
||||
'users_name' => $this->users[$i]->name,
|
||||
);
|
||||
|
|
|
@ -62,8 +62,8 @@ class WizardBasicTest extends WizardTestBase {
|
|||
// it.
|
||||
$this->assertUrl($view2['page[path]']);
|
||||
$this->assertText($view2['page[title]']);
|
||||
$this->assertText($node1->title);
|
||||
$this->assertText($node2->title);
|
||||
$this->assertText($node1->label());
|
||||
$this->assertText($node2->label());
|
||||
|
||||
// Check if we have the feed.
|
||||
$this->assertLinkByHref(url($view2['page[feed_properties][path]']));
|
||||
|
@ -72,9 +72,9 @@ class WizardBasicTest extends WizardTestBase {
|
|||
// The feed should have the same title and nodes as the page.
|
||||
$this->assertText($view2['page[title]']);
|
||||
$this->assertRaw(url('node/' . $node1->nid, array('absolute' => TRUE)));
|
||||
$this->assertText($node1->title);
|
||||
$this->assertText($node1->label());
|
||||
$this->assertRaw(url('node/' . $node2->nid, array('absolute' => TRUE)));
|
||||
$this->assertText($node2->title);
|
||||
$this->assertText($node2->label());
|
||||
|
||||
// Go back to the views page and check if this view is there.
|
||||
$this->drupalGet('admin/structure/views');
|
||||
|
@ -103,8 +103,8 @@ class WizardBasicTest extends WizardTestBase {
|
|||
// Make sure the view only displays the node we expect.
|
||||
$this->assertUrl($view3['page[path]']);
|
||||
$this->assertText($view3['page[title]']);
|
||||
$this->assertText($node1->title);
|
||||
$this->assertNoText($node2->title);
|
||||
$this->assertText($node1->label());
|
||||
$this->assertNoText($node2->label());
|
||||
|
||||
// Go back to the views page and check if this view is there.
|
||||
$this->drupalGet('admin/structure/views');
|
||||
|
@ -122,8 +122,8 @@ class WizardBasicTest extends WizardTestBase {
|
|||
// Visit a random page (not the one that displays the view itself) and look
|
||||
// for the expected node title in the block.
|
||||
$this->drupalGet('user');
|
||||
$this->assertText($node1->title);
|
||||
$this->assertNoText($node2->title);
|
||||
$this->assertText($node1->label());
|
||||
$this->assertNoText($node2->label());
|
||||
|
||||
// Check if the export screen works.
|
||||
$this->drupalGet('admin/structure/views/view/' . $view3['name'] . '/export');
|
||||
|
|
|
@ -57,16 +57,16 @@ class WizardItemsPerPageTest extends WizardTestBase {
|
|||
$this->assertUrl($view['page[path]']);
|
||||
$this->assertText($view['page[title]']);
|
||||
$content = $this->drupalGetContent();
|
||||
$this->assertText($node5->title);
|
||||
$this->assertText($node4->title);
|
||||
$this->assertText($node3->title);
|
||||
$this->assertText($node2->title);
|
||||
$this->assertNoText($node1->title);
|
||||
$this->assertNoText($page_node->title);
|
||||
$pos5 = strpos($content, $node5->title);
|
||||
$pos4 = strpos($content, $node4->title);
|
||||
$pos3 = strpos($content, $node3->title);
|
||||
$pos2 = strpos($content, $node2->title);
|
||||
$this->assertText($node5->label());
|
||||
$this->assertText($node4->label());
|
||||
$this->assertText($node3->label());
|
||||
$this->assertText($node2->label());
|
||||
$this->assertNoText($node1->label());
|
||||
$this->assertNoText($page_node->label());
|
||||
$pos5 = strpos($content, $node5->label());
|
||||
$pos4 = strpos($content, $node4->label());
|
||||
$pos3 = strpos($content, $node3->label());
|
||||
$pos2 = strpos($content, $node2->label());
|
||||
$this->assertTrue($pos5 < $pos4 && $pos4 < $pos3 && $pos3 < $pos2, t('The nodes appear in the expected order in the page display.'));
|
||||
|
||||
// Put the block into the first sidebar region, visit a page that displays
|
||||
|
@ -79,15 +79,15 @@ class WizardItemsPerPageTest extends WizardTestBase {
|
|||
$this->drupalPost('admin/structure/block', $edit, t('Save blocks'));
|
||||
$this->drupalGet('user');
|
||||
$content = $this->drupalGetContent();
|
||||
$this->assertText($node5->title);
|
||||
$this->assertText($node4->title);
|
||||
$this->assertText($node3->title);
|
||||
$this->assertNoText($node2->title);
|
||||
$this->assertNoText($node1->title);
|
||||
$this->assertNoText($page_node->title);
|
||||
$pos5 = strpos($content, $node5->title);
|
||||
$pos4 = strpos($content, $node4->title);
|
||||
$pos3 = strpos($content, $node3->title);
|
||||
$this->assertText($node5->label());
|
||||
$this->assertText($node4->label());
|
||||
$this->assertText($node3->label());
|
||||
$this->assertNoText($node2->label());
|
||||
$this->assertNoText($node1->label());
|
||||
$this->assertNoText($page_node->label());
|
||||
$pos5 = strpos($content, $node5->label());
|
||||
$pos4 = strpos($content, $node4->label());
|
||||
$pos3 = strpos($content, $node3->label());
|
||||
$this->assertTrue($pos5 < $pos4 && $pos4 < $pos3, t('The nodes appear in the expected order in the block display.'));
|
||||
}
|
||||
}
|
||||
|
|
|
@ -44,12 +44,12 @@ class WizardSortingTest extends WizardTestBase {
|
|||
$this->assertUrl($view1['page[path]']);
|
||||
$this->assertText($view1['page[title]']);
|
||||
$content = $this->drupalGetContent();
|
||||
$this->assertText($node1->title);
|
||||
$this->assertText($node2->title);
|
||||
$this->assertText($node3->title);
|
||||
$pos1 = strpos($content, $node1->title);
|
||||
$pos2 = strpos($content, $node2->title);
|
||||
$pos3 = strpos($content, $node3->title);
|
||||
$this->assertText($node1->label());
|
||||
$this->assertText($node2->label());
|
||||
$this->assertText($node3->label());
|
||||
$pos1 = strpos($content, $node1->label());
|
||||
$pos2 = strpos($content, $node2->label());
|
||||
$pos3 = strpos($content, $node3->label());
|
||||
$this->assertTrue($pos1 < $pos2 && $pos2 < $pos3, t('The nodes appear in the expected order in a view that sorts by oldest first.'));
|
||||
|
||||
// Create a view that sorts newest first.
|
||||
|
@ -67,12 +67,12 @@ class WizardSortingTest extends WizardTestBase {
|
|||
$this->assertUrl($view2['page[path]']);
|
||||
$this->assertText($view2['page[title]']);
|
||||
$content = $this->drupalGetContent();
|
||||
$this->assertText($node3->title);
|
||||
$this->assertText($node2->title);
|
||||
$this->assertText($node1->title);
|
||||
$pos3 = strpos($content, $node3->title);
|
||||
$pos2 = strpos($content, $node2->title);
|
||||
$pos1 = strpos($content, $node1->title);
|
||||
$this->assertText($node3->label());
|
||||
$this->assertText($node2->label());
|
||||
$this->assertText($node1->label());
|
||||
$pos3 = strpos($content, $node3->label());
|
||||
$pos2 = strpos($content, $node2->label());
|
||||
$pos1 = strpos($content, $node1->label());
|
||||
$this->assertTrue($pos3 < $pos2 && $pos2 < $pos1, t('The nodes appear in the expected order in a view that sorts by newest first.'));
|
||||
}
|
||||
}
|
||||
|
|
|
@ -15,9 +15,9 @@ class views_handler_argument_node_nid extends views_handler_argument_numeric {
|
|||
function title_query() {
|
||||
$titles = array();
|
||||
|
||||
$result = db_query("SELECT n.title FROM {node} n WHERE n.nid IN (:nids)", array(':nids' => $this->value));
|
||||
foreach ($result as $term) {
|
||||
$titles[] = check_plain($term->title);
|
||||
$nodes = node_load_multiple($this->value);
|
||||
foreach ($nodes as $node) {
|
||||
$titles[] = check_plain($node->label());
|
||||
}
|
||||
return $titles;
|
||||
}
|
||||
|
|
|
@ -17,10 +17,20 @@ class views_handler_argument_node_vid extends views_handler_argument_numeric {
|
|||
function title_query() {
|
||||
$titles = array();
|
||||
|
||||
$result = db_query("SELECT n.title FROM {node_revision} n WHERE n.nid IN (:nids)", array(':nids' => $this->value));
|
||||
foreach ($result as $term) {
|
||||
$titles[] = check_plain($term->title);
|
||||
$results = db_query("SELECT nr.vid, nr.nid, nr.title FROM {node_revision} nr WHERE nr.vid IN (:vids)", array(':vids' => $this->value))->fetchAllAssoc('vid', PDO::FETCH_ASSOC);
|
||||
|
||||
$nids = array();
|
||||
foreach ($results as $result) {
|
||||
$nids[] = $result['nid'];
|
||||
}
|
||||
|
||||
$nodes = node_load_multiple(array_unique($nids));
|
||||
|
||||
foreach ($results as $result) {
|
||||
$nodes[$result['nid']]->set('title', $result['title']);
|
||||
$titles[] = check_plain($nodes[$result['nid']]->label());
|
||||
}
|
||||
|
||||
return $titles;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -96,7 +96,7 @@ class views_plugin_argument_validate_node extends views_plugin_argument_validate
|
|||
}
|
||||
|
||||
// Save the title() handlers some work.
|
||||
$this->argument->validated_title = check_plain($node->title);
|
||||
$this->argument->validated_title = check_plain($node->label());
|
||||
|
||||
if (empty($types)) {
|
||||
return TRUE;
|
||||
|
@ -115,8 +115,8 @@ class views_plugin_argument_validate_node extends views_plugin_argument_validate
|
|||
$test = drupal_map_assoc($nids->value);
|
||||
$titles = array();
|
||||
|
||||
$result = db_query("SELECT * FROM {node} WHERE nid IN (:nids)", array(':nids' => $nids->value));
|
||||
foreach ($result as $node) {
|
||||
$nodes = node_load_multiple($nids->value);
|
||||
foreach ($nodes as $node) {
|
||||
if ($types && empty($types[$node->type])) {
|
||||
return FALSE;
|
||||
}
|
||||
|
@ -127,7 +127,7 @@ class views_plugin_argument_validate_node extends views_plugin_argument_validate
|
|||
}
|
||||
}
|
||||
|
||||
$titles[] = check_plain($node->title);
|
||||
$titles[] = check_plain($node->label());
|
||||
unset($test[$node->nid]);
|
||||
}
|
||||
|
||||
|
|
|
@ -182,7 +182,7 @@ function template_preprocess_views_view_row_search(&$vars) {
|
|||
$node->body .= module_invoke('taxonomy', 'nodeapi', $node, 'update index');
|
||||
|
||||
$vars['url'] = url('node/' . $nid);
|
||||
$vars['title'] = check_plain($node->title);
|
||||
$vars['title'] = check_plain($node->label());
|
||||
|
||||
$info = array();
|
||||
$info['type'] = node_type_get_name($node);
|
||||
|
|
|
@ -24,9 +24,9 @@ class views_handler_argument_user_uid extends views_handler_argument_numeric {
|
|||
|
||||
$titles = array();
|
||||
|
||||
$result = db_query("SELECT u.name FROM {users} u WHERE u.uid IN (:uids)", array(':uids' => $this->value));
|
||||
foreach ($result as $term) {
|
||||
$titles[] = check_plain($term->name);
|
||||
$users = user_load_multiple($this->value);
|
||||
foreach ($users as $account) {
|
||||
$titles[] = check_plain($account->label());
|
||||
}
|
||||
return $titles;
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue