Skip to content

Commit

Permalink
Commit file missed earlier
Browse files Browse the repository at this point in the history
  • Loading branch information
ADmad committed Nov 10, 2019
1 parent 1614077 commit 7cd2d24
Showing 1 changed file with 53 additions and 0 deletions.
53 changes: 53 additions & 0 deletions tests/test_app/TestApp/View/Widget/TestUsingViewWidget.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
<?php
declare(strict_types=1);

/**
* CakePHP(tm) : Rapid Development Framework (https://cakephp.org)
* Copyright (c) Cake Software Foundation, Inc. (https://cakefoundation.org)
*
* Licensed under The MIT License
* Redistributions of files must retain the above copyright notice.
*
* @copyright Copyright (c) Cake Software Foundation, Inc. (https://cakefoundation.org)
* @link https://cakephp.org CakePHP(tm) Project
* @since 4.0.0
* @license https://opensource.org/licenses/mit-license.php MIT License
*/
namespace TestApp\View\Widget;

use Cake\View\Form\ContextInterface;
use Cake\View\StringTemplate;
use Cake\View\View;
use Cake\View\Widget\WidgetInterface;

class TestUsingViewWidget implements WidgetInterface
{
protected $_templates;

protected $_view;

public function __construct(StringTemplate $templates, View $view)
{
$this->_templates = $templates;
$this->_view = $view;
}

public function getView(): View
{
return $this->_view;
}

public function render(array $data, ContextInterface $context): string
{
return '<success></success>';
}

public function secureFields(array $data): array
{
if (!isset($data['name']) || $data['name'] === '') {
return [];
}

return [$data['name']];
}
}

0 comments on commit 7cd2d24

Please sign in to comment.