code/controller/behavior/editable.php
protected function _afterRead(ControllerContextModel $context)
    {
        $entity = $context->result;

        //Add the notice if the resource is locked
        if($this->canEdit() && $entity->isLockable() && $entity->isLocked())
        {
            //Prevent a re-render of the message
            if($context->request->getUrl() != $context->request->getReferrer())
            {
                if($entity->isLockable() && $entity->isLocked())
                {
                    $user    = $entity->getLocker();
                    $date    = $this->getObject('date', array('date' => $entity->locked_on));
                    $message = $this->getObject('translator')->translate(
                        'Locked by {name} {date}', array('name' => $user->getName(), 'date' => $date->humanize())
                    );

                    $context->response->addMessage($message, 'notice');
                }
            }
        }
    }
protected function _afterRead(ControllerContextModel $context)
    {
        $entity = $context->result;

        //Add the notice if the resource is locked
        if($this->canEdit() && $entity->isLockable() && $entity->isLocked())
        {
            //Prevent a re-render of the message
            if($context->request->getUrl() != $context->request->getReferrer())
            {
                if($entity->isLockable() && $entity->isLocked())
                {
                    $user    = $entity->getLocker();
                    $date    = $this->getObject('date', array('date' => $entity->locked_on));
                    $message = $this->getObject('translator')->translate(
                        'Locked by {name} {date}', array('name' => $user->getName(), 'date' => $date->humanize())
                    );

                    $context->response->addMessage($message, 'notice');
                }
            }
        }
    }
protected function _afterRead ( ControllerContextModel $ context ) { $ entity = $ context -> result ; //Add the notice if the resource is locked if ( $ this -> canEdit ( ) && $ entity -> isLockable ( ) && $ entity -> isLocked ( ) ) { //Prevent a re-render of the message if ( $ context -> request -> getUrl ( ) != $ context -> request -> getReferrer ( ) ) { if ( $ entity -> isLockable ( ) && $ entity -> isLocked ( ) ) { $ user = $ entity -> getLocker ( ) ; $ date = $ this -> getObject ( 'date' , array ( 'date' => $ entity -> locked_on ) ) ; $ message = $ this -> getObject ( 'translator' ) -> translate ( 'Locked by {name} {date}' , array ( 'name' => $ user -> getName ( ) , 'date' => $ date -> humanize ( ) ) ) ; $ context -> response -> addMessage ( $ message , 'notice' ) ; } } } }
Add a lock flash message if the resource is locked

@param   ControllerContextModel   $context A command context object
@return  void
Add a lock flash message if the resource is locked