config() 공개 메소드

If $key is an array and $value is empty, $key will be merged directly with $this->_config If $key is a string it will be passed into Hash::insert
public config ( mixed $key = null, mixed $value = null ) : TranslationsEvent
$key mixed
$value mixed
리턴 TranslationsEvent
 /**
  * Class constructor
  *
  * @param string $prefix CRUD component events name prefix
  * @param array $models List of models to be fetched in beforeRenderEvent
  * @return void
  */
 public function __construct(CrudSubject $subject)
 {
     $this->_subject = $subject;
     $this->_config = $this->_defaults;
     if (!isset($subject->crud)) {
         return;
     }
     $this->_crud = $subject->crud;
     if ($translations = $this->_crud->config('translations')) {
         $this->config($translations);
     }
 }
 /**
  * List of events implemented by this class
  *
  * @return array
  */
 public function implementedEvents()
 {
     return array($this->_crud->config('eventPrefix') . '.beforeRender' => 'beforeRender');
 }
 /**
  * Test that providing configuration for a new
  * listener in the Crud setting should preserve
  * the defaults and add the new listener to the array
  *
  * @return void
  */
 public function testConstructMerging2()
 {
     $Collection = $this->getMock('ComponentCollection');
     $config = array('listeners' => array());
     $Crud = new CrudComponent($Collection, $config);
     $result = $Crud->config();
     $expected = array('actions' => array(), 'eventPrefix' => 'Crud', 'listeners' => array('RelatedModels' => 'Crud.RelatedModels'), 'messages' => array('domain' => 'crud', 'invalidId' => array('code' => 400, 'class' => 'BadRequestException', 'text' => 'Invalid id'), 'recordNotFound' => array('code' => 404, 'class' => 'NotFoundException', 'text' => 'Not found'), 'badRequestMethod' => array('code' => 405, 'class' => 'MethodNotAllowedException', 'text' => 'Method not allowed. This action permits only {methods}')), 'eventLogging' => false);
     $this->assertEquals($expected, $result);
 }