Inspect field handles and edit fields from element edit forms
Switch branches/tags
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Failed to load latest commit information.
resources/img
src
.craftplugin
.gitignore
CHANGELOG.md
LICENSE
LICENSE.md
README.md
composer.json

README.md

CP Field Inspect plugin for Craft CMS 3.x

CP Field Inspect is a tiny utility plugin making content modelling a little bit easier in Craft.

Did you forget a field handle? Mouse over the cogwheel next to the field title, and CP Field Inspect will tell you.

Need to adjust some field settings? Click the cogwheel; CP Field Inspect will redirect you to the relevant field's settings page – and back to the content when you're done.

Additionally, CP Field Inspect will add a link in your element edit forms to manage source settings (e.g. entry type, category group) in the same manner.

Note that CP Field Inspect will only be active for admin users.

Easily inspect field handles and edit fields

Plugin icon: CUSTOMIZE SEARCH by creative outlet from the Noun Project

Looking for the Craft 2 version? It's right here.

Requirements

This plugin requires Craft CMS 3.0.0-beta.23 or later.

Tested and working w/ Craft CMS 3 RC1 (3.0.0.-beta.29).

Installation

To install the plugin, follow these instructions.

  1. Open your terminal and go to your Craft project:

     cd /path/to/project
    
  2. Then tell Composer to load the plugin:

     composer require mmikkel/cp-field-inspect
    
  3. In the Control Panel, go to Settings → Plugins and click the “Install” button for CP Field Inspect.

Cogwheels not appearing?

A semi-common issue with CP Field Inspect is that the field cogwheels do not appear, even if the currently logged in user has admin privileges.

This is most often due to the site having one or several custom modules installed, that call Craft::$app->getUser()->getIdentity() or similar (i.e. to check the currently logged-in user's group affiliations or permissions) from their constructor or init() methods. This has been confirmed, due to a bug in Craft, to prevent CP Field Inspect from displaying the cogwheels, since Craft::$app->getUser()->getIsAdmin() will actually return a false negative in plugins, in this scenario.

The workaround is to defer any calls to Craft::$app->getUser() (such as Craft::$app->getUser()->getIdentity() etc) in the offending custom module to the Plugins::AFTER_LOAD_PLUGINS event; essentially letting plugins like CP Field Inspect load before calling that method (in Craft 3, modules are loaded before plugins).

Here's how the workaround can look (the below would go in your custom module's primary class):

public function init()
{
    parent::init();
    self::$instance = $this;

    // Defer further boot-up until after plugins have loaded
    Event::on(
        Plugins::class,
        Plugins::EVENT_AFTER_LOAD_PLUGINS,
        function () {
            $this->doIt();
        }
    );

    Craft::info(
        Craft::t(
            'my-module',
            '{name} module loaded',
            ['name' => 'My Module']
        ),
        __METHOD__
    );
}

protected function doIt()
{
    $currentUser = Craft::$app->getUser()->getIdentity();
    // ... all other logic dependant on `$currentUser`
}

Disclaimer

This plugin is provided free of charge and you can do whatever you want with it. CP Field Inspect is very unlikely to mess up your stuff, but just to be clear: the author is not responsible for data loss or any other problems resulting from the use of this plugin.

Please report any bugs, feature requests or other issues here. Note that this is a hobby project and no promises are made regarding response time, feature implementations or bug fixes.

Pull requests are extremely welcome