core/modules/edit/css/edit.css | 66 ++++++------------------------------------- core/modules/edit/edit.module | 62 ++++++++++++++++++++-------------------- core/modules/edit/images/icon-edit-active.png | Bin 0 -> 508 bytes core/modules/edit/images/icon-edit.png | Bin 0 -> 536 bytes 4 files changed, 38 insertions(+), 90 deletions(-) diff --git a/core/modules/edit/css/edit.css b/core/modules/edit/css/edit.css index 9109d62..0d8c6b3 100644 --- a/core/modules/edit/css/edit.css +++ b/core/modules/edit/css/edit.css @@ -62,67 +62,17 @@ /** - * Edit's bar — inspired by core's toolbar.module & shortcut.module. + * Toolbar. */ -#editbar, -#editbar * { - border: 0; - font-size: 100%; - line-height: inherit; - list-style: none; - margin: 0; - outline: 0; - padding: 0; - text-align: left; /* LTR */ - vertical-align: baseline; -} -#editbar { - position: relative; - background: #666; - color: #ccc; - font: normal small "Lucida Grande", Verdana, sans-serif; - margin: 0 -20px; - padding: 0 20px; - -moz-box-shadow: 0 3px 20px #000; - -webkit-box-shadow: 0 3px 20px #000; - box-shadow: 0 3px 20px #000; - z-index: 500; -} -#editbar ul { - padding: 5px 0 2px 0; - height: 28px; - line-height: 24px; - margin-left:5px; /* LTR */ -} -#editbar ul li, -#editbar ul li a { - float: left; /* LTR */ - padding: 0 5px 0 5px; - margin-right: 5px; /* LTR */ - -moz-border-radius: 5px; - -webkit-border-radius: 5px; - border-radius: 5px; -} -#editbar a { - padding: 5px 10px 5px 5px; - line-height: 24px; - color: #fefefe; - font-size: .846em; - text-decoration: none; -} -#editbar a:focus, -#editbar a:hover, -#editbar a.active { - color: #fff; +.icon-edit:before { + background-image: url("../images/icon-edit.png"); } -#editbar ul li a:focus, -#editbar ul li a:hover, -#editbar ul li a.active:focus { - background: #555; +.icon-edit:active:before, +.active .icon-edit:before { + background-image: url("../images/icon-edit-active.png"); } -#editbar ul li a.active:hover, -#editbar ul li a.active { - background: #000; +.toolbar .tray.edit.active { + z-index: 300; } diff --git a/core/modules/edit/edit.module b/core/modules/edit/edit.module index 1d0c70c..6f71fdd 100644 --- a/core/modules/edit/edit.module +++ b/core/modules/edit/edit.module @@ -51,46 +51,47 @@ function edit_menu() { } /** - * Implements hook_page_alter(). + * Implements hook_toolbar(). */ -function edit_page_alter(&$page) { +function edit_toolbar() { if (path_is_admin(current_path())) { return; } - $page['page_top']['edit'] = array( - 'view_edit_toggle' => array( - '#prefix' => '

' . t('In-place edit operations') . '

', - 'content' => array( - array( - '#theme' => 'menu_local_task', - '#link' => array('title' => t('View'), 'href' => current_path(), 'localized_options' => array('fragment' => 'view', 'attributes' => array('class' => array('edit_view-edit-toggle', 'edit-view')))), - '#active' => TRUE, - ), - array( - '#theme' => 'menu_local_task', - '#link' => array('title' => t('Quick edit'), 'href' => current_path(), 'localized_options' => array('fragment' => 'quick-edit', 'attributes' => array('class' => array('edit_view-edit-toggle', 'edit-edit')))), - ), + $tab['edit'] = array( + 'tab' => array( + 'title' => t('Edit'), + 'href' => '', + 'html' => FALSE, + 'attributes' => array( + 'class' => array('icon', 'icon-edit',), ), - '#attached' => array( - 'library' => array( - array('edit', 'edit'), + ), + 'tray' => array( + 'view_edit_toggle' => array( + '#prefix' => '

' . t('In-place edit operations') . '

', + 'content' => array( + array( + '#theme' => 'menu_local_task', + '#link' => array('title' => t('View'), 'href' => current_path(), 'localized_options' => array('fragment' => 'view', 'attributes' => array('class' => array('edit_view-edit-toggle', 'edit-view')))), + '#active' => TRUE, + ), + array( + '#theme' => 'menu_local_task', + '#link' => array('title' => t('Quick edit'), 'href' => current_path(), 'localized_options' => array('fragment' => 'quick-edit', 'attributes' => array('class' => array('edit_view-edit-toggle', 'edit-edit')))), + ), + ), + '#attached' => array( + 'library' => array( + array('edit', 'edit'), + ), ), ), ), - '#post_render' => array( - 'edit_editbar_post_render', - ), ); -} -/** - * Post-render function to remove the editbar if nothing editable is present. - */ -function edit_editbar_post_render($html) { - global $editbar; - return ($editbar !== TRUE) ? '' : $html; + return $tab; } /** @@ -217,9 +218,6 @@ function edit_preprocess_field(&$variables) { $field_access = field_access('edit', $name, $entity->entityType(), $entity); $editability = _edit_analyze_field_editability($field, $instance_info, $formatter_type); if ($entity_access && $field_access && $editability != 'disabled') { - global $editbar; - $editbar = TRUE; - // Mark this field as editable and provide metadata through data- attributes. $variables['attributes']['data-edit-field-label'] = $instance_info->definition['label']; $variables['attributes']['data-edit-id'] = $entity->entityType() . ':' . $entity->id() . ':' . $name . ':' . $langcode . ':' . $view_mode; diff --git a/core/modules/edit/images/icon-edit-active.png b/core/modules/edit/images/icon-edit-active.png new file mode 100644 index 0000000000000000000000000000000000000000..45557dba85e1122d15e6c93798191973dbe4801b GIT binary patch literal 508 zcmV zj*t<`28@tQP)6tmbc4_dfC<6|&Ia@e#J2$f;?w;f3KeQgVpA;r+M>JNE&%ce95DJoY)eB&bi3VB>fVj%2%AvN=dQ8~NBh*zr>L)Qc^3R)2|s${cSktn=eE*TySVY(`!v;?_aP9#RWSS%>g z5W>o$mSu^=rI^p>+M@Y16U*{~My3x$GEs*1^E z!VyJOEEfIgbb9MBG-y68o$opxkH?h0i(2*LVsFRy>-81bD3waS)*Ub!jRL^`@P|Os zy!OR17!25OIF!J<@_87Cv0q#CvJ^Esu7E-C4dYk9Fm6yemCNOhuJC#D`u%fTA@7Rt)!^IR%<)9JK>OuI6%Sp0tSCX<4XsovJjogB6~p1s-S77%Dj{8DII|)7WozZHQEwctyc4- z>N)(=@Av7tn)P};6Ai#PC6elx!RN`|)YBLDdObtjtn);Sk?mmo1Z^}LUYfq5i*1M7 zH5g-`&~(;Rc8nT}<2XUuE*OFxVbe3SgM0(}<+?6^^dZpO?KYLz3qU^XZnN3+pYg!{ a2`~VZj|M0JA(K)70000