-
Notifications
You must be signed in to change notification settings - Fork 7
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[imp] create common base views ready for usage
- Loading branch information
1 parent
52283b9
commit 3d6e66f
Showing
4 changed files
with
161 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
<?php | ||
/** | ||
* @package Phproberto.Joomla-Twig | ||
* @subpackage Twig | ||
* | ||
* @copyright Copyright (C) 2017-2018 Roberto Segura López, Inc. All rights reserved. | ||
* @license See COPYING.txt | ||
*/ | ||
|
||
namespace Phproberto\Joomla\Twig\View; | ||
|
||
defined('_JEXEC') || die; | ||
|
||
use Phproberto\Joomla\Twig\View\HtmlView; | ||
|
||
/** | ||
* Base form view. | ||
* | ||
* @since 0.1.6 | ||
*/ | ||
abstract class FormView extends HtmlView | ||
{ | ||
/** | ||
* Load layout data. | ||
* | ||
* @return self | ||
*/ | ||
protected function loadLayoutData() | ||
{ | ||
$model = $this->getModel(); | ||
|
||
return array_merge( | ||
parent::loadLayoutData(), | ||
[ | ||
'form' => $model->getForm(), | ||
'model' => $model | ||
] | ||
); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
<?php | ||
/** | ||
* @package Phproberto.Joomla-Twig | ||
* @subpackage Twig | ||
* | ||
* @copyright Copyright (C) 2017-2018 Roberto Segura López, Inc. All rights reserved. | ||
* @license See COPYING.txt | ||
*/ | ||
|
||
namespace Phproberto\Joomla\Twig\View; | ||
|
||
defined('_JEXEC') || die; | ||
|
||
use Phproberto\Joomla\Twig\View\ItemView; | ||
|
||
/** | ||
* Base item form view. | ||
* | ||
* @since 0.1.6 | ||
*/ | ||
abstract class ItemFormView extends ItemView | ||
{ | ||
/** | ||
* Load layout data. | ||
* | ||
* @return self | ||
*/ | ||
protected function loadLayoutData() | ||
{ | ||
return array_merge( | ||
parent::loadLayoutData(), | ||
[ | ||
'form' => $this->getModel()->getForm() | ||
] | ||
); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
<?php | ||
/** | ||
* @package Phproberto.Joomla-Twig | ||
* @subpackage Twig | ||
* | ||
* @copyright Copyright (C) 2017-2018 Roberto Segura López, Inc. All rights reserved. | ||
* @license See COPYING.txt | ||
*/ | ||
|
||
namespace Phproberto\Joomla\Twig\View; | ||
|
||
defined('_JEXEC') || die; | ||
|
||
use Phproberto\Joomla\Twig\View\HtmlView; | ||
|
||
/** | ||
* Base item view. | ||
* | ||
* @since __DEPLOY_VERSION__ | ||
*/ | ||
abstract class ItemView extends HtmlView | ||
{ | ||
/** | ||
* Load layout data. | ||
* | ||
* @return self | ||
*/ | ||
protected function loadLayoutData() | ||
{ | ||
$model = $this->getModel(); | ||
|
||
return array_merge( | ||
parent::loadLayoutData(), | ||
[ | ||
'item' => $model->getItem(), | ||
'model' => $model | ||
] | ||
); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
<?php | ||
/** | ||
* @package Phproberto.Joomla-Twig | ||
* @subpackage Twig | ||
* | ||
* @copyright Copyright (C) 2017-2018 Roberto Segura López, Inc. All rights reserved. | ||
* @license See COPYING.txt | ||
*/ | ||
|
||
namespace Phproberto\Joomla\Twig\View; | ||
|
||
defined('_JEXEC') || die; | ||
|
||
use Phproberto\Joomla\Twig\View\HtmlView; | ||
|
||
/** | ||
* Base list view. | ||
* | ||
* @since __DEPLOY_VERSION__ | ||
*/ | ||
abstract class ListView extends HtmlView | ||
{ | ||
/** | ||
* Load layout data. | ||
* | ||
* @return self | ||
*/ | ||
protected function loadLayoutData() | ||
{ | ||
$model = $this->getModel(); | ||
|
||
return array_merge( | ||
parent::loadLayoutData(), | ||
[ | ||
'items' => $model->getItems(), | ||
'state' => $model->getState(), | ||
'pagination' => $model->getPagination(), | ||
'filterForm' => $model->getFilterForm(), | ||
'activeFilters' => $model->getActiveFilters(), | ||
'model' => $model | ||
] | ||
); | ||
} | ||
} |