summaryrefslogtreecommitdiff
path: root/modules/node
diff options
context:
space:
mode:
authorDries Buytaert <dries@buytaert.net>2008-12-16 23:57:33 +0000
committerDries Buytaert <dries@buytaert.net>2008-12-16 23:57:33 +0000
commit574a2e47eea1bc8e2ea13240e407a32e4b728560 (patch)
tree7c124110e7e71df958fff50b2fb8e0832dd18204 /modules/node
parent18d22419f3da39ca4bf92f46d605a25957f311be (diff)
downloadbrdo-574a2e47eea1bc8e2ea13240e407a32e4b728560.tar.gz
brdo-574a2e47eea1bc8e2ea13240e407a32e4b728560.tar.bz2
- Patch #345866 by alexanderpas, justinrandell, Dave Reid: remove from hook_block().
Diffstat (limited to 'modules/node')
-rw-r--r--modules/node/node.module28
-rw-r--r--modules/node/node.test30
2 files changed, 45 insertions, 13 deletions
diff --git a/modules/node/node.module b/modules/node/node.module
index 27ff4be3f..c657a1548 100644
--- a/modules/node/node.module
+++ b/modules/node/node.module
@@ -1779,21 +1779,23 @@ function node_revision_list($node) {
}
/**
- * Implementation of hook_block().
+ * Implementation of hook_block_list().
*/
-function node_block($op = 'list', $delta = '') {
- if ($op == 'list') {
- $blocks['syndicate']['info'] = t('Syndicate');
- // Not worth caching.
- $blocks['syndicate']['cache'] = BLOCK_NO_CACHE;
- return $blocks;
- }
- elseif ($op == 'view') {
- $block['subject'] = t('Syndicate');
- $block['content'] = theme('feed_icon', url('rss.xml'), t('Syndicate'));
+function node_block_list() {
+ $blocks['syndicate']['info'] = t('Syndicate');
+ // Not worth caching.
+ $blocks['syndicate']['cache'] = BLOCK_NO_CACHE;
+ return $blocks;
+}
- return $block;
- }
+/**
+ * Implementation of hook_block_view().
+ */
+function node_block_view($delta = '') {
+ $block['subject'] = t('Syndicate');
+ $block['content'] = theme('feed_icon', url('rss.xml'), t('Syndicate'));
+
+ return $block;
}
/**
diff --git a/modules/node/node.test b/modules/node/node.test
index 2e8a94d92..ab2a25f87 100644
--- a/modules/node/node.test
+++ b/modules/node/node.test
@@ -507,3 +507,33 @@ class NodeTitleXSSTestCase extends DrupalWebTestCase {
$this->assertNoRaw($xss, t('Harmful tags are escaped when editing a node.'));
}
}
+
+class NodeBlockTestCase extends DrupalWebTestCase {
+ function getInfo() {
+ return array(
+ 'name' => t('Block availability'),
+ 'description' => t('Check if the syndicate block is available.'),
+ 'group' => t('Node'),
+ );
+ }
+
+ function setUp() {
+ parent::setUp();
+
+ // Create and login user
+ $admin_user = $this->drupalCreateUser(array('administer blocks'));
+ $this->drupalLogin($admin_user);
+ }
+
+ function testSearchFormBlock() {
+ // Set block title to confirm that the interface is availble.
+ $this->drupalPost('admin/build/block/configure/node/syndicate', array('title' => $this->randomName(8)), t('Save block'));
+ $this->assertText(t('The block configuration has been saved.'), t('Block configuration set.'));
+
+ // Set the block to a region to confirm block is availble.
+ $edit = array();
+ $edit['node_syndicate[region]'] = 'footer';
+ $this->drupalPost('admin/build/block', $edit, t('Save blocks'));
+ $this->assertText(t('The block settings have been updated.'), t('Block successfully move to footer region.'));
+ }
+}