1

:)

I am trying to develop a new fieldtype and would like to display different markup depending on whether the field was requested by the user or in the backend.

Is there a reliable way to detect in the display_field() function whether it was requested via the {exp:safecracker} {custom_fields} loop.

3

You could check for the presence of the Safecracker library:

if (isset(ee()->safecracker))

Or check if you're in the control panel

if (REQ === 'CP')
| improve this answer | |
  • 1
    That's what I do too. Use if(isset($this->EE->safecracker)) for versions prior to EE 2.6 though. ;) – Justin Kimbrell Jul 31 '13 at 18:14
  • Thanks very much gents. Just got around to it and it works brilliant. :) – spacesuitdiver Aug 27 '13 at 17:16

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.