Download the PHP package johnfmorton/craft-entry-editor-links without Composer

On this page you can find all versions of the php package johnfmorton/craft-entry-editor-links. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.

FAQ

After the download, you have to make one include require_once('vendor/autoload.php');. After that you have to import the classes with use statements.

Example:
If you use only one package a project is not needed. But if you use more then one package, without a project it is not possible to import the classes with use statements.

In general, it is recommended to use always a project to download your libraries. In an application normally there is more than one library needed.
Some PHP packages are not free to download and because of that hosted in private repositories. In this case some credentials are needed to access such packages. Please use the auth.json textarea to insert credentials, if a package is coming from a private repository. You can look here for more information.

  • Some hosting areas are not accessible by a terminal or SSH. Then it is not possible to use Composer.
  • To use Composer is sometimes complicated. Especially for beginners.
  • Composer needs much resources. Sometimes they are not available on a simple webspace.
  • If you are using private repositories you don't need to share your credentials. You can set up everything on our site and then you provide a simple download link to your team member.
  • Simplify your Composer build process. Use our own command line tool to download the vendor folder as binary. This makes your build process faster and you don't need to expose your credentials for private repositories.
Please rate this library. Is it a good library?

Informations about the package craft-entry-editor-links

Entry Editor Link Plugin

Entry Editor Link is a plugin for Craft CMS, version 4 or version 5. It helps create "edit this entry" links for your entry authors on the front-end pages of your site. It's design to work well with statically cached sites, like those using FastCGI Cache.

See the Overview section for more information.

The screenshot below is an example of how my blog looks to me when I'm logged into Craft CMS. The pencil icon is a link that allows me to quickly jump to the entry's edit page in the control panel.

Requirements

This plugin requires Craft CMS 4.4.7.1 or later, and PHP 8.0.2 or later. It is also compatible with Craft CMS 5.x.

Installation

You can install this plugin from the Plugin Store or with Composer.

From the Plugin Store

Go to the Plugin Store in your project’s Control Panel and search for “entry-editor-links”. Then press “Install”.

With Composer

Open your terminal and run the following commands:

Overview

This plugin helps generate links to an entry's edit page within the Craft CMS control panel. While this functionality is easy to create in Twig templates, using the getCpEditUrl function. Using this function on statically cached pages risks exposing the entry's edit URL to users who don't have permission to edit the entry.

This plugin solves that problem by creating an API endpoint that returns the entry's edit URL only for logged-in Craft users that have permission to edit the entry. You can then use Javascript to render the edit link in the DOM. Sample Javascript to do this is in the Using the plugin section below.

The edit button should only be rendered on the front end of the site, not when the entry is displayed in the Preview pane within the control panel. The plugin provides a Twig function, isFrontEndPageView(), that can be used to determine if a page is being rendered on the front end of the site. This conditional allows you to render the data-edit-link attribute only on the front end of the site.

Plugin functionality

The plugin does two things:

  1. It provides an endpoint that expects an entry ID and returns a JSON object with the entry's edit URL.
  2. It also provides a Twig function, isFrontEndPageView() to determine if a page is being rendered on the front end of the site. This is to prevent the edit links from being displayed when a user has the preview pane open while editing an entry in the control panel or if the entry is being rendered on the front end of the site using a preview token.

Using the plugin

The first step is to render the data-edit-link attribute on the element in your template to display the entry ID for the entry you wish to be able to edit.

Do this by wrapping the attribute in the isFrontEndPageView conditional that checks if the page is being rendered on the front end of the site.

For example, if you have a list of entries, you can add the data-edit-link attribute to the element that wraps each entry. You can put this data attribute on the article element that wraps each entry.

Then, after a page loads, look for any instance of the data-edit-link attribute and query the plugin's API endpoint to get the entry's edit URL. If the user is logged in and has permission to edit the entry, the plugin will return the entry's edit URL. Then you can add a link to the edit page in the DOM for the entry.

Here's a basic example of how you can do this using JavaScript. You can add this to a JavaScript file that is loaded on the front end of your site. You will likely want to customize the styles and text of the edit link to match your site's design.

Using the plugin with FastCGI Cache

If you're using FastCGI Cache, you'll need to add a rule to prevent the plugin's API endpoint from being cached. This is because the plugin's API endpoint returns different data depending on whether the user is logged in and has permission to edit the entry. If the endpoint is cached, the edit link will be shown to users who don't have permission to edit the entry.

Here are examples of what that rule might look like for Apache and Nginx servers. Your server may require a different rules, but this should give you an idea of how to exclude ^/actions/entry-editor-links URLs from being cached.

Using a .htaccess file with an Apache server

Using a nginx.conf file with an Nginx server


All versions of craft-entry-editor-links with dependencies

PHP Build Version
Package Version
Requires php Version >=8.0.2
craftcms/cms Version ^4.4.7.1|^5.9.18
Composer command for our command line client (download client) This client runs in each environment. You don't need a specific PHP version etc. The first 20 API calls are free. Standard composer command

The package johnfmorton/craft-entry-editor-links contains the following files

Loading the files please wait ...