Initialization Function markSlotAsBeingEdited()

protected final function markSlotAsBeingEdited(
$beingEdited = true
)

Summary

Allows you to tell the CMS that an Admin is currently editing your Plugin.

Where You Can Use It

Can be used in your plugin's init() method, from Zenario 7.0 onwards.

Description

In some cases, you may wish an Admin to have more control over your Plugin than the Instance Settings allows. In this case, one potential solution is to have an inline editing mode using AJAX reloads.

If you call markSlotAsBeingEdited(), the CMS will indicate to the Admin that they are currently editing details of your Plugin.

Parameters

$beingEdited

You can cancel any previous markSlotAsBeingEdited() calls by setting this to false.

Example

public function init() {
    if ($this->get($this->containerId(). 'edit') && $this->core->checkPriv()) {
        $this->markSlotAsBeingEdited();
    }
}

public function showSlot() {
    if ($this->core->checkPriv()) {
        echo '
            <a', $this->refreshPluginSlotAnchor('&'. $this->containerId(). 'edit=1'), '>
                ', $this->phrase('_EDIT'),'
            </a>';
    }
}

This will create a simple Plugin that enters edit mode when the user clicks on the "Edit" link.