PHPackages                             emilushi/in-place-editing - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [Utility &amp; Helpers](/categories/utility)
4. /
5. emilushi/in-place-editing

ActiveCakephp-plugin[Utility &amp; Helpers](/categories/utility)

emilushi/in-place-editing
=========================

An in-place-editor for CakePHP3

220PHP

Since Aug 1Pushed 6y ago2 watchersCompare

[ Source](https://github.com/emilushi/CakePHP-InPlace-Editing)[ Packagist](https://packagist.org/packages/emilushi/in-place-editing)[ RSS](/packages/emilushi-in-place-editing/feed)WikiDiscussions master Synced today

READMEChangelogDependenciesVersions (1)Used By (0)

InPlace Editing Plugin
======================

[](#inplace-editing-plugin)

Version 1.0.0

An in-place-edit plugin for [CakePHP](http://cakephp.org), which uses the power of jQuery. This plugin allows you to easily make any field in your views become editable.

Combined with the awesomeness of Ajax you can make changes to your data right from the view without even reloading the page.

Requirements
------------

[](#requirements)

- [jQuery](http://jquery.com/)
- [Jeditable](https://github.com/NicolasCARPi/jquery_jeditable)
- PHP version: PHP 7.1+
- CakePHP version: 3.5.X

Installation
------------

[](#installation)

1. Go to your CakePHP App directory using a terminal.
2. type `composer require emilushi/in-place-editing`
3. To load the plugin type: `bin/cake plugin load InPlaceEditing`
4. Under `src/View/Application.php` on `initialize` method add the following line: `$this->loadHelper('InPlaceEditing.InPlaceEditing');`

#### Using InPlaceEditing on your view

[](#using-inplaceediting-on-your-view)

The editing helper will allow you to add an `input` control to your views that will behave like the a div element (by default, or any other HTML element if you wish) on your view until you click/double-click/hover/etc on it, then it will appear as a text input, or a drop-down list, or any element supported by [Jeditable](https://github.com/NicolasCARPi/jquery_jeditable) jQuery plugin. Let's assume our Model is **OrdersTable**, Controller **Orders** and field to edit is called **comments**. Add the code below under your view to generate the needed to field which will trigger `jeditable`.

```

```

##### Including CSRF Token

[](#including-csrf-token)

To add a CSRF token to your Ajax request by setting the `X-CSRF-Token`, add the following setting to the view:

```
'csrfToken' => json_encode($this->request->getParam('_csrfToken'))

```

For example, following the example above:

```
    'toolTip'       => 'Click to edit',
    'containerType' => 'div',
    'csrfToken' => json_encode($this->request->getParam('_csrfToken'))
]) ?>

```

Don't forget to add the comma trailing the last setting (in this case, `containerType`). You may have to unlock the action in your `initialize()` function in your controller:

```
$this->Security->setConfig('unlockedActions', ['inPlaceEditing']);

```

#### Add an action handler in your controller

[](#add-an-action-handler-in-your-controller)

Before you may need to disable security component for this specific action by adding: `$this->Security->setConfig('unlockedActions', ['inPlaceEditing']);` on `beforeFilter` method of your controller. Then add the following action on your controller which will update our **$order-&gt;comments** field and return the new value to the view.

```
public function inPlaceEditing($id = null) {
    $this->getRequest()->allowMethod('ajax');

    $order = $this-Orders->get($id);

    //You may need to unset data['id']
    if(isset($data['id'])) {
        unset($data['id']);
    }

    $order = $this->Orders->pathchEntity($order, $data);

    if($this->Orders->save($order)) {
        $comment = $order->comments;

        $this->set(compact('comment'));
        $this->set('_serialize', 'comment');

        $this->viewBuilder()->disableAutoLayout();
        $this->viewBuilder()->setClassName('Ajax');
    }
}

```

#### Create the action handler view

[](#create-the-action-handler-view)

Since we set the view class name to **Ajax** on our action we need to create a new ajax view on the above path:

```
src/Template/Orders/ajax/in_place_editing.ctp

```

**Note, that you need to replace Orders with your own controller Name.** and on the new file you created add the above code:

```
echo $comment;

```

**Note, here as well you need to replace `$comment` with you own field.**

#### Loading JS

[](#loading-js)

InPlaceEditingHelper will generate an input for your field and a piece of jQuery code for each field. The generated jQuery code is injected using `$this->Html->scriptBlock()` method which requires that you have somewhere on your layout a `fetch` method and it needs to be below the code you use for loading `jQuery` and `jquery-jeditable`. Which will look like: ``

ToDo
----

[](#todo)

This version of the plugin is by no means perfect, but it works. I'll be working on making things a lot easier in the future updates.

- Write tests.

License
-------

[](#license)

This code is licensed under the [MIT license](http://www.opensource.org/licenses/mit-license.php).

Notes
-----

[](#notes)

Feel free to submit bug reports or suggest improvements in a ticket or fork this project and improve upon it yourself. Contributions welcome.

###  Health Score

20

—

LowBetter than 14% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity9

Limited adoption so far

Community13

Small or concentrated contributor base

Maturity36

Early-stage or recently created project

 Bus Factor2

2 contributors hold 50%+ of commits

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

### Community

Maintainers

![](https://www.gravatar.com/avatar/f809917381f35512d054a6a2f57a3399b1a7f20a4602508c0318fcbefe07bff4?d=identicon)[emilushi](/maintainers/emilushi)

---

Top Contributors

[![emilushi](https://avatars.githubusercontent.com/u/3394343?v=4)](https://github.com/emilushi "emilushi (5 commits)")[![enigmartin](https://avatars.githubusercontent.com/u/4219124?v=4)](https://github.com/enigmartin "enigmartin (4 commits)")[![arteq](https://avatars.githubusercontent.com/u/432634?v=4)](https://github.com/arteq "arteq (1 commits)")[![kareypowell](https://avatars.githubusercontent.com/u/1640789?v=4)](https://github.com/kareypowell "kareypowell (1 commits)")[![pchec](https://avatars.githubusercontent.com/u/3714330?v=4)](https://github.com/pchec "pchec (1 commits)")

### Embed Badge

![Health badge](/badges/emilushi-in-place-editing/health.svg)

```
[![Health](https://phpackages.com/badges/emilushi-in-place-editing/health.svg)](https://phpackages.com/packages/emilushi-in-place-editing)
```

###  Alternatives

[tomlerendu/laravel-convert-case-middleware

Convert request and response keys to and from camel and snake case.

2870.0k](/packages/tomlerendu-laravel-convert-case-middleware)[byrokrat/id

Data types for swedish personal identity and corporation id numbers

1597.7k5](/packages/byrokrat-id)[verbb/shippy

A framework agnostic, multi-carrier shipping library for PHP.

1610.1k1](/packages/verbb-shippy)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
