Seditio Source
Root |
./othercms/croogo-4.0.7/vendor/friendsofcake/crud/src/Action/ViewAction.php
<?php
namespace Crud\Action;

use
Crud\Traits\FindMethodTrait;
use
Crud\Traits\SerializeTrait;
use
Crud\Traits\ViewTrait;
use
Crud\Traits\ViewVarTrait;

/**
 * Handles 'View' Crud actions
 *
 * Licensed under The MIT License
 * For full copyright and license information, please see the LICENSE.txt
 */
class ViewAction extends BaseAction
{
    use
FindMethodTrait;
    use
SerializeTrait;
    use
ViewTrait;
    use
ViewVarTrait;

   
/**
     * Default settings for 'view' actions
     *
     * `enabled` Is this crud action enabled or disabled
     *
     * `findMethod` The default `Model::find()` method for reading data
     *
     * `view` A map of the controller action and the view to render
     * If `NULL` (the default) the controller action name will be used
     *
     * @var array
     */
   
protected $_defaultConfig = [
       
'enabled' => true,
       
'scope' => 'entity',
       
'findMethod' => 'all',
       
'view' => null,
       
'viewVar' => null,
       
'serialize' => [],
    ];

   
/**
     * Generic HTTP handler
     *
     * @param string|null $id Record id
     * @return void
     */
   
protected function _handle($id = null)
    {
       
$subject = $this->_subject();
       
$subject->set(['id' => $id]);

       
$this->_findRecord($id, $subject);
       
$this->_trigger('beforeRender', $subject);
    }
}