Check If concrete5 Site Is in Edit Mode

Sometimes you may wish to check whether or not your site is currently in edit mode. This can easily be done with the simple code below.

global $c;

if ($c->isEditMode()) {
	// Site is in edit mode

else {
	// Site is not in edit mode

The global $c gives access to the collection object.

One Comment

  1. handoyo said:

    Hi,thanks for the snippet.Do you know what event was triggered by the edit button in the admin toolbar and what code does it related to?Thanks

    February 12, 2013

Leave a Reply

Your email address will not be published. Required fields are marked *