Skip to content

Instantly share code, notes, and snippets.

@piotrpog piotrpog/quick_edit.twig
Last active Jun 7, 2019

Embed
What would you like to do?
Quick edit link component for Craft CMS. More info on http://craftsnippets.com/articles/quick-edit
{# v2 #}
{# http://craftsnippets.com/articles/quick-edit #}
{% if currentUser and currentUser.can('accessCp') and not craft.app.request.isLivePreview %}
{% if (entry is defined and entry.isEditable) or (category is defined and category.isEditable) %}
<div class="edit-button">
<a href="{{ entry.getCpEditUrl() ?? category.getCpEditUrl() }}" target="_blank" class="button is-info">
{{'edit'|t}}
</a>
</div>
{% endif %}
{% endif %}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.