diff --git a/core/modules/block/block.module b/core/modules/block/block.module index a08254a..3cc1482 100644 --- a/core/modules/block/block.module +++ b/core/modules/block/block.module @@ -89,6 +89,10 @@ function block_theme() { 'render element' => 'elements', 'template' => 'block', ), + 'block_list' => array( + 'render element' => 'form', + 'template' => 'block-list', + ), ); } diff --git a/core/modules/block/css/block.admin.css b/core/modules/block/css/block.admin.css index 7cd9233..fe1ef3e 100644 --- a/core/modules/block/css/block.admin.css +++ b/core/modules/block/css/block.admin.css @@ -32,12 +32,12 @@ a.block-demo-backlink:hover { text-decoration: underline; } -.block-list-region { +.layout-region { -webkit-box-sizing: border-box; -moz-box-sizing: border-box; box-sizing: border-box; } -.block-list-right { +.block-list-secondary { border: 1px solid #bfbfbf; border-bottom-width: 0; } @@ -49,10 +49,7 @@ a.block-demo-backlink:hover { list-style: none; padding: 0.1em 0; } -.block-list a:before { - content: '+ '; -} -.block-list-right .form-type-search { +.block-list-secondary .form-type-search { padding: 0 1em; } @@ -61,35 +58,35 @@ a.block-demo-backlink:hover { screen and (min-width: 780px), (orientation: landscape) and (min-device-height: 780px) { - .block-list-left { - float: left; /* LTR */ + .block-list-primary { + float: right; /* LTR */ width: 75%; - padding-right: 2em; - } - [dir="rtl"] .block-list-left { - float: right; padding-left: 2em; - padding-right: 0; + } + [dir="rtl"] .block-list-primary { + float: left; + padding-left: 0; + padding-right: 2em; } - .block-list-right { - float: right; /* LTR */ + .block-list-secondary { + float: left; /* LTR */ width: 25%; } - [dir="rtl"] .block-list-right { - float: left; + [dir="rtl"] .block-list-secondary { + float: right; } /* @todo File an issue to add a standard class to all text-like inputs */ - .block-list-right .form-autocomplete, - .block-list-right .form-text, - .block-list-right .form-tel, - .block-list-right .form-email, - .block-list-right .form-url, - .block-list-right .form-search, - .block-list-right .form-number, - .block-list-right .form-color, - .block-list-right textarea { + .block-list-secondary .form-autocomplete, + .block-list-secondary .form-text, + .block-list-secondary .form-tel, + .block-list-secondary .form-email, + .block-list-secondary .form-url, + .block-list-secondary .form-search, + .block-list-secondary .form-number, + .block-list-secondary .form-color, + .block-list-secondary textarea { -webkit-box-sizing: border-box; -moz-box-sizing: border-box; box-sizing: border-box; @@ -108,8 +105,8 @@ screen and (min-width: 780px), screen and (max-width: 1020px), (orientation: landscape) and (max-device-height: 1020px) { - .toolbar-vertical .block-list-left, - .toolbar-vertical .block-list-right { + .toolbar-vertical .block-list-primary, + .toolbar-vertical .block-list-secondary { float: none; width: auto; padding-right: 0; diff --git a/core/modules/block/lib/Drupal/block/BlockListController.php b/core/modules/block/lib/Drupal/block/BlockListController.php index b9d6218..9d2ed6a 100644 --- a/core/modules/block/lib/Drupal/block/BlockListController.php +++ b/core/modules/block/lib/Drupal/block/BlockListController.php @@ -120,6 +120,7 @@ public function getFormID() { */ public function buildForm(array $form, array &$form_state) { $entities = $this->load(); + $form['#theme'] = array('block_list'); $form['#attached']['library'][] = array('system', 'drupal.tableheader'); $form['#attached']['library'][] = array('block', 'drupal.block'); $form['#attached']['library'][] = array('block', 'drupal.block.admin'); @@ -127,13 +128,7 @@ public function buildForm(array $form, array &$form_state) { // Add a last region for disabled blocks. $block_regions_with_disabled = $this->regions + array(BLOCK_REGION_NONE => BLOCK_REGION_NONE); - $form['left']['#type'] = 'container'; - $form['left']['#attributes']['class'] = array( - 'block-list-region', - 'block-list-left', - ); - - $form['left']['block_regions'] = array( + $form['block_regions'] = array( '#type' => 'value', '#value' => $block_regions_with_disabled, ); @@ -144,11 +139,11 @@ public function buildForm(array $form, array &$form_state) { $weight_delta = round(count($entities) / 2); // Build the form tree. - $form['left']['edited_theme'] = array( + $form['edited_theme'] = array( '#type' => 'value', '#value' => $this->theme, ); - $form['left']['blocks'] = array( + $form['blocks'] = array( '#type' => 'table', '#header' => array( t('Block'), @@ -174,7 +169,7 @@ public function buildForm(array $form, array &$form_state) { // Loop over each region and build blocks. foreach ($block_regions_with_disabled as $region => $title) { - $form['left']['blocks']['#tabledrag'][] = array( + $form['blocks']['#tabledrag'][] = array( 'match', 'sibling', 'block-region-select', @@ -182,27 +177,27 @@ public function buildForm(array $form, array &$form_state) { NULL, FALSE, ); - $form['left']['blocks']['#tabledrag'][] = array( + $form['blocks']['#tabledrag'][] = array( 'order', 'sibling', 'block-weight', 'block-weight-' . $region, ); - $form['left']['blocks'][$region] = array( + $form['blocks'][$region] = array( '#attributes' => array( 'class' => array('region-title', 'region-title-' . $region, 'odd'), 'no_striping' => TRUE, ), ); - $form['left']['blocks'][$region]['title'] = array( + $form['blocks'][$region]['title'] = array( '#markup' => $region != BLOCK_REGION_NONE ? $title : t('Disabled'), '#wrapper_attributes' => array( 'colspan' => 5, ), ); - $form['left']['blocks'][$region . '-message'] = array( + $form['blocks'][$region . '-message'] = array( '#attributes' => array( 'class' => array( 'region-message', @@ -211,7 +206,7 @@ public function buildForm(array $form, array &$form_state) { ), ), ); - $form['left']['blocks'][$region . '-message']['message'] = array( + $form['blocks'][$region . '-message']['message'] = array( '#markup' => '' . t('No blocks in this region') . '', '#wrapper_attributes' => array( 'colspan' => 5, @@ -222,19 +217,19 @@ public function buildForm(array $form, array &$form_state) { foreach ($blocks[$region] as $info) { $entity_id = $info['entity_id']; - $form['left']['blocks'][$entity_id] = array( + $form['blocks'][$entity_id] = array( '#attributes' => array( 'class' => array('draggable'), ), ); - $form['left']['blocks'][$entity_id]['info'] = array( + $form['blocks'][$entity_id]['info'] = array( '#markup' => check_plain($info['admin_label']), '#wrapper_attributes' => array( 'class' => array('block'), ), ); - $form['left']['blocks'][$entity_id]['region-theme']['region'] = array( + $form['blocks'][$entity_id]['region-theme']['region'] = array( '#type' => 'select', '#default_value' => $region, '#empty_value' => BLOCK_REGION_NONE, @@ -246,12 +241,12 @@ public function buildForm(array $form, array &$form_state) { ), '#parents' => array('blocks', $entity_id, 'region'), ); - $form['left']['blocks'][$entity_id]['region-theme']['theme'] = array( + $form['blocks'][$entity_id]['region-theme']['theme'] = array( '#type' => 'hidden', '#value' => $this->theme, '#parents' => array('blocks', $entity_id, 'theme'), ); - $form['left']['blocks'][$entity_id]['weight'] = array( + $form['blocks'][$entity_id]['weight'] = array( '#type' => 'weight', '#default_value' => $info['weight'], '#delta' => $weight_delta, @@ -261,33 +256,27 @@ public function buildForm(array $form, array &$form_state) { 'class' => array('block-weight', 'block-weight-' . $region), ), ); - $form['left']['blocks'][$entity_id]['operations'] = $this->buildOperations($info['entity']); + $form['blocks'][$entity_id]['operations'] = $this->buildOperations($info['entity']); } } } // Do not allow disabling the main system content block when it is present. - if (isset($form['left']['blocks']['system_main']['region'])) { - $form['left']['blocks']['system_main']['region']['#required'] = TRUE; + if (isset($form['blocks']['system_main']['region'])) { + $form['blocks']['system_main']['region']['#required'] = TRUE; } - $form['left']['actions'] = array( + $form['actions'] = array( '#tree' => FALSE, '#type' => 'actions', ); - $form['left']['actions']['submit'] = array( + $form['actions']['submit'] = array( '#type' => 'submit', '#value' => t('Save blocks'), '#button_type' => 'primary', ); - $form['right']['#type'] = 'container'; - $form['right']['#attributes']['class'] = array( - 'block-list-region', - 'block-list-right', - ); - - $form['right']['title'] = array( + $form['place_blocks']['title'] = array( '#type' => 'container', '#children' => '