2017 © Pedro Peláez
 

craft-plugin cp-field-inspect

Inspect field handles and easily edit field settings

image

mmikkel/cp-field-inspect

Inspect field handles and easily edit field settings

  • Wednesday, March 28, 2018
  • by mmikkel
  • Repository
  • 1 Watchers
  • 15 Stars
  • 5,710 Installations
  • JavaScript
  • 6 Dependents
  • 0 Suggesters
  • 0 Forks
  • 0 Open issues
  • 6 Versions
  • 93 % Grown

The README.md

CP Field Inspect plugin for Craft CMS

Scrutinizer Code Quality, (*1)

CP Field Inspect is a tiny utility plugin, that makes content modelling a little bit easier in Craft., (*2)

The plugin adds two things to the Craft control panel (hence the first part of the name!):, (*3)

  1. A link for quickly accessing field settings to the field handles in element edit forms (for admin users who opt to display those). This link appears as a little cogwheel inside the field handle, and clicking this link redirects you to the fields' settings pages, and back to your content when you save the settings., (*4)

  2. Links for quickly accessing element source settings (i.e. entry type, section, volume, category group etc.) to element edit forms, cards, chips and inline Matrix entries (nee blocks), (*5)

img.png, (*6)

The caveats!

CP Field Inspect will only add field settings links and element source buttons to the Craft control panel if, (*7)

If either of the above are false, CP Field Inspect will do absolutely nothing., (*8)

Additionally, the field settings cogwheels requires the "Show field handles in edit forms" admin user preference., (*9)

Requirements

This plugin requires Craft CMS 5.0+., (*10)

But, the plugin doesn't appear to do anything!

If CP Field Inspect's links won't appear in environments where allowAdminChanges is enabled and the user is an admin, the reason is most likely due to the site having one or several plugins or custom modules installed, that call Craft::$app->getUser()->getIdentity() or related methods from within 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., (*11)

The workaround is to defer any calls to Craft::$app->getUser() (such as Craft::$app->getUser()->getIdentity() etc.) in the offending custom module to after Craft has finished initialising (the below would go in your custom module's primary class):, (*12)

public function init()
{
    parent::init();

    Craft::$app->onInit(function () {
        $this->doIt();
    }

}

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

Disclaimer

Please report any bugs or other issues here., (*13)

Plugin icon: CUSTOMIZE SEARCH by creative outlet from the Noun Project, (*14)

The Versions

28/03 2018

dev-master

9999999-dev

Inspect field handles and easily edit field settings

  Sources   Download

MIT

The Requires

 

cms craftcms craft-plugin craft cp field inspect

28/03 2018

1.0.4

1.0.4.0

Inspect field handles and easily edit field settings

  Sources   Download

MIT

The Requires

 

cms craftcms craft-plugin craft cp field inspect

07/12 2017

1.0.2

1.0.2.0

Inspect field handles and easily edit field settings

  Sources   Download

MIT

The Requires

 

cms craftcms craft-plugin craft cp field inspect

06/12 2017

1.0.1

1.0.1.0

Inspect field handles and easily edit field settings

  Sources   Download

MIT

The Requires

 

cms craftcms craft-plugin craft cp field inspect

06/12 2017

1.0.0

1.0.0.0

Inspect field handles and easily edit field settings

  Sources   Download

MIT

The Requires

 

cms craftcms craft-plugin craft cp field inspect

23/10 2017

1.0.0-beta.1

1.0.0.0-beta1

Inspect field handles and easily edit field settings

  Sources   Download

MIT

The Requires

 

cms craftcms craft-plugin craft cp field inspect