Commit 9dd8de4d authored by alexpott's avatar alexpott

Issue #2410623 by ultimike, chx: D6-D8 Custom Block Migration not visible in region

parent 16d3e1cb
......@@ -58,9 +58,12 @@ public static function create(ContainerInterface $container, array $configuratio
public function transform($value, MigrateExecutable $migrate_executable, Row $row, $destination_property) {
list($pages, $roles, $old_visibility) = $value;
$visibility = array();
$visibility['request_path']['pages'] = $pages;
$visibility['request_path']['id'] = 'request_path';
$visibility['request_path']['negate'] = !$old_visibility;
if (!empty($pages)) {
$visibility['request_path']['pages'] = $pages;
$visibility['request_path']['id'] = 'request_path';
$visibility['request_path']['negate'] = !$old_visibility;
}
if (!empty($roles)) {
foreach ($roles as $key => $role_id) {
......
......@@ -157,7 +157,7 @@ public function load() {
'custom' => '0',
'throttle' => '0',
'visibility' => '0',
'pages' => '',
'pages' => 'node/1',
'title' => '',
'cache' => '-1',
))->values(array(
......
......@@ -376,7 +376,7 @@ public function load() {
'link_path' => 'admin',
'router_path' => 'admin',
'link_title' => 'Test 2',
'options' => 'a:2:{s:5:"query";a:1:{s:3:"foo";s:3:"bar";}s:10:"attributes";a:1:{s:5:"title";a:1:{i:0;s:16:"Test menu link 2";}}}',
'options' => 'a:2:{s:5:"query";s:7:"foo=bar";s:10:"attributes";a:1:{s:5:"title";s:16:"Test menu link 2";}}',
'module' => 'menu',
'hidden' => '0',
'external' => '0',
......
......@@ -393,6 +393,12 @@ public function load() {
))->values(array(
'name' => 'dblog_row_limit',
'value' => 'i:1000;',
))->values(array(
'name' => 'drupal_badge_color',
'value' => 's:12:"powered-blue";',
))->values(array(
'name' => 'drupal_badge_size',
'value' => 's:5:"80x15";',
))->values(array(
'name' => 'drupal_http_request_fails',
'value' => 'b:0;',
......
......@@ -95,7 +95,7 @@ public function testBlockMigration() {
$this->assertIdentical('sidebar_first', $test_block_user->getRegion());
$this->assertIdentical('bartik', $test_block_user->getTheme());
$visibility = $test_block_user->getVisibility();
$this->assertTrue(empty($visibility['request_path']['pages']));
$this->assertTrue(empty($visibility));
$this->assertIdentical(0, $test_block_user->getWeight());
$test_block_user_1 = $blocks['user_1'];
......@@ -103,7 +103,7 @@ public function testBlockMigration() {
$this->assertIdentical('sidebar_first', $test_block_user_1->getRegion());
$this->assertIdentical('bartik', $test_block_user_1->getTheme());
$visibility = $test_block_user_1->getVisibility();
$this->assertTrue(empty($visibility['request_path']['pages']));
$this->assertTrue(empty($visibility));
$this->assertIdentical(0, $test_block_user_1->getWeight());
$test_block_user_2 = $blocks['user_2'];
......@@ -136,7 +136,9 @@ public function testBlockMigration() {
$this->assertIdentical('footer', $test_block_system->getRegion());
$this->assertIdentical('bartik', $test_block_system->getTheme());
$visibility = $test_block_system->getVisibility();
$this->assertTrue(empty($visibility['request_path']['pages']));
$this->assertIdentical('request_path', $visibility['request_path']['id']);
$this->assertIdentical('node/1', $visibility['request_path']['pages']);
$this->assertTrue($visibility['request_path']['negate']);
$this->assertIdentical(-5, $test_block_system->getWeight());
// Check menu blocks
......@@ -145,7 +147,7 @@ public function testBlockMigration() {
$this->assertIdentical('header', $test_block_menu->getRegion());
$this->assertIdentical('bartik', $test_block_menu->getTheme());
$visibility = $test_block_menu->getVisibility();
$this->assertTrue(empty($visibility['request_path']['pages']));
$this->assertTrue(empty($visibility));
$this->assertIdentical(-5, $test_block_menu->getWeight());
// Check custom blocks
......@@ -154,7 +156,9 @@ public function testBlockMigration() {
$this->assertIdentical('content', $test_block_block->getRegion());
$this->assertIdentical('bartik', $test_block_block->getTheme());
$visibility = $test_block_block->getVisibility();
$this->assertIdentical($visibility['request_path']['pages'], '<front>');
$this->assertIdentical('request_path', $visibility['request_path']['id']);
$this->assertIdentical('<front>', $visibility['request_path']['pages']);
$this->assertFalse($visibility['request_path']['negate']);
$this->assertIdentical(0, $test_block_block->getWeight());
$test_block_block_1 = $blocks['block_1'];
......@@ -162,7 +166,9 @@ public function testBlockMigration() {
$this->assertIdentical('right', $test_block_block_1->getRegion());
$this->assertIdentical('bluemarine', $test_block_block_1->getTheme());
$visibility = $test_block_block_1->getVisibility();
$this->assertIdentical($visibility['request_path']['pages'], 'node');
$this->assertIdentical('request_path', $visibility['request_path']['id']);
$this->assertIdentical('node', $visibility['request_path']['pages']);
$this->assertFalse($visibility['request_path']['negate']);
$this->assertIdentical(-4, $test_block_block_1->getWeight());
$test_block_block_2 = $blocks['block_2'];
......@@ -170,7 +176,7 @@ public function testBlockMigration() {
$this->assertIdentical('right', $test_block_block_2->getRegion());
$this->assertIdentical('test_theme', $test_block_block_2->getTheme());
$visibility = $test_block_block_2->getVisibility();
$this->assertTrue(empty($visibility['request_path']['pages']));
$this->assertTrue(empty($visibility));
$this->assertIdentical(-7, $test_block_block_2->getWeight());
$test_block_block_3 = $blocks['block_3'];
......@@ -178,7 +184,7 @@ public function testBlockMigration() {
$this->assertIdentical('left', $test_block_block_3->getRegion());
$this->assertIdentical('test_theme', $test_block_block_3->getTheme());
$visibility = $test_block_block_3->getVisibility();
$this->assertTrue(empty($visibility['request_path']['pages']));
$this->assertTrue(empty($visibility));
$this->assertIdentical(-2, $test_block_block_3->getWeight());
}
}
......@@ -66,7 +66,7 @@ public function testMenuLinks() {
$this->assertIdentical($menu_link->getDescription(), 'Test menu link 2');
$this->assertIdentical($menu_link->isEnabled(), TRUE);
$this->assertIdentical($menu_link->isExpanded(), TRUE);
$this->assertIdentical($menu_link->link->options, ['query' => ['foo' => 'bar'], 'attributes' => ['title' => ['Test menu link 2']]]);
$this->assertIdentical($menu_link->link->options, ['query' => 'foo=bar', 'attributes' => ['title' => 'Test menu link 2']]);
$this->assertIdentical($menu_link->link->uri, 'user-path:admin');
$this->assertIdentical($menu_link->getWeight(), 12);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment