From f9e44fc40a4d3323d005e74846773e96a8d79abf Mon Sep 17 00:00:00 2001
From: Dries <dries@buytaert.net>
Date: Mon, 14 May 2012 22:11:31 -0400
Subject: [PATCH] - Patch #967566 by mariusz.slonina, rbayliss, joestewart,
 xjm, tim.plunkett, indytechcook, tsvenson, adnasa, oriol_e9g | DocuAnt:
 Several important Core User settings lack support for
 hook_field_extra_fields().

---
 core/modules/block/block.module | 13 +++++++++++++
 core/modules/block/block.test   | 28 ++++++++++++++++++++++++++++
 2 files changed, 41 insertions(+)

diff --git a/core/modules/block/block.module b/core/modules/block/block.module
index f7d8dc0c5b44..97f59e9e6095 100644
--- a/core/modules/block/block.module
+++ b/core/modules/block/block.module
@@ -625,6 +625,19 @@ function block_form_user_profile_form_alter(&$form, &$form_state) {
   }
 }
 
+/**
+ * Implements hook_field_extra_fields().
+ */
+function block_field_extra_fields() {
+  $extra['user']['user']['form']['block'] = array(
+    'label' => t('Personalize blocks'),
+    'description' => t('Block module form element.'),
+    'weight' => 3,
+  );
+
+  return $extra;
+}
+
 /**
  * Implements hook_user_presave().
  */
diff --git a/core/modules/block/block.test b/core/modules/block/block.test
index 7782e77d5be2..e6b2e42f3817 100644
--- a/core/modules/block/block.test
+++ b/core/modules/block/block.test
@@ -848,6 +848,34 @@ class BlockHiddenRegionTestCase extends WebTestBase {
   }
 }
 
+
+/**
+ * Tests personalized block settings for user accounts.
+ */
+class BlockUserAccountSettingsTestCase extends WebTestBase {
+  public static function getInfo() {
+    return array(
+      'name' => 'Personalized block settings',
+      'description' => 'Tests the block settings in user accounts.',
+      'group' => 'Block',
+    );
+  }
+
+  public function setUp() {
+    parent::setUp(array('block', 'field_ui'));
+    $admin_user = $this->drupalCreateUser(array('administer users'));
+    $this->drupalLogin($admin_user);
+  }
+
+  /**
+   * Tests that the personalized block is shown.
+   */
+  function testAccountSettingsPage() {
+    $this->drupalGet('admin/config/people/accounts/fields');
+    $this->assertText(t('Personalize blocks'), 'Personalized block is present.');
+  }
+}
+
 /**
  * Functional tests for the language list configuration forms.
  */
-- 
GitLab