Gistorial

Published: Thu, 25 Sep 2014

See the original gist.

Frontend links for page editing in backend

This "tutorial" is based on a forum thread started by Ormente with responses from Martijn. Consult that thread for further discussion.

It's often useful to be able to go directly to the backend to edit a page while browsing your site. You can make such a link in Wolf by copying this code into a snippet (filter set to -none-):

<?php

    // Check there's a user session
    AuthUser::load();

    // Check the user is logged in and has page_edit permission.
    if (AuthUser::isLoggedIn() && AuthUser::hasPermission('page_edit')) {

        $url = BASE_URL.'admin/page/edit/'.$this->id();
        echo '<span class="quickedit"><a href="'.$url.'">Edit this page</a></span>';
    }
?>

Save the snippet as 'quickedit', and call the snippet in your layout with:

<?php $this->includeSnippet('quickedit'); ?>

where you want your edit link to appear.

You could also:

Thanks to Ormente for this suggestion!


See also (now - 20141008) draft.sx.