Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Issue #3298846 - Local actions #821

Merged
merged 1 commit into from
Aug 9, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
langcode: en
status: true
dependencies:
theme:
- droopler_theme
id: primaryadminactions
theme: droopler_theme
region: admin_tabs
weight: 0
provider: null
plugin: local_actions_block
settings:
id: local_actions_block
label: 'Primary admin actions'
label_display: '0'
provider: core
visibility: { }
11 changes: 11 additions & 0 deletions themes/custom/droopler_theme/droopler_theme.theme
Original file line number Diff line number Diff line change
Expand Up @@ -343,6 +343,17 @@ function droopler_theme_preprocess_block(&$variables) {
}
}

/**
* Implements hook_preprocess_HOOK() for menu_local_action.
*/
function droopler_theme_preprocess_menu_local_action(&$variables) {
$variables['link']['#options']['attributes']['class'] = [
'btn',
'btn-outline-primary',
'btn-sm',
];
}

/**
* Check if current route is node with paragraphs or other defined route.
*
Expand Down
11 changes: 11 additions & 0 deletions themes/custom/droopler_theme/scss/barrio/_actions.scss
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
/**
* @file
* Theme styling for actions
*/

nav.action-links li {
list-style: none;
margin-bottom: 20px;
margin-right: 10px;
display: inline-block;
}
1 change: 1 addition & 0 deletions themes/custom/droopler_theme/scss/style.scss
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@
//
// Styleguide 2.0

@import 'barrio/actions';
@import 'barrio/breadcrumb';
@import 'barrio/contextual';
@import 'barrio/feed-icon';
Expand Down
Original file line number Diff line number Diff line change
@@ -1,12 +1,46 @@
{% extends "@droopler_theme/block/block.html.twig" %}
{#
/**
* @file
* Theme override for local actions (primary admin actions.)
* Default theme implementation to display a block.
*
* Available variables:
* - plugin_id: The ID of the block implementation.
* - label: The configured label of the block if visible.
* - configuration: A list of the block's configuration values.
* - label: The configured label for the block.
* - label_display: The display settings for the label.
* - provider: The module or other provider that provided this block plugin.
* - Block plugin specific settings will also be stored here.
* - content: The content of this block.
* - attributes: array of HTML attributes populated by modules, intended to
* be added to the main container tag of this template.
* - id: A valid HTML ID and guaranteed unique.
* - title_attributes: Same as attributes, except applied to the main title
* tag that appears in the template.
* - content_attributes: Same as attributes, except applied to the main content
* tag that appears in the template.
* - title_prefix: Additional output populated by modules, intended to be
* displayed in front of the main title tag that appears in the template.
* - title_suffix: Additional output populated by modules, intended to be
* displayed after the main title tag that appears in the template.
*
* @see template_preprocess_block()
*
* @ingroup themeable
*/
#}
{% block content %}
{% if content %}
<nav class="action-links">{{ content }}</nav>
{% endif %}
{% endblock %}
{%
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I am overriding the entire block, otherwise empty link list will appear for anonymous, together with admin-tabs region.

set classes = [
'block',
'block-' ~ configuration.provider|clean_class,
'block-' ~ plugin_id|clean_class,
]
%}

{% if content|render|trim %}
<div{{ attributes.addClass(classes) }}>
<div{{ content_attributes.addClass('content') }}>
<nav class="action-links">{{ content }}</nav>
</div>
</div>
{% endif %}
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
'container'
]
%}
{% if content %}
{% if content|render|trim %}
<div{{ attributes.addClass(classes) }}>
{{ content }}
</div>
Expand Down