ADD MVC for part
This commit is contained in:
9
admin/form/part.xml
Normal file
9
admin/form/part.xml
Normal file
@ -0,0 +1,9 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<form>
|
||||
<field
|
||||
name="component_name"
|
||||
type="text"
|
||||
label="JFIELD_NAME_LABEL"
|
||||
required="true"
|
||||
/>
|
||||
</form>
|
30
admin/src/Model/PartModel.php
Normal file
30
admin/src/Model/PartModel.php
Normal file
@ -0,0 +1,30 @@
|
||||
<?php
|
||||
/**
|
||||
* @package Depot.Administrator
|
||||
* @subpackage com_depot
|
||||
* @author Thomas Kuschel <thomas@kuschel.at>
|
||||
* @copyright (C) 2023 KW4NZ, <https://www.kuschel.at>
|
||||
* @license GNU General Public License version 2 or later; see LICENSE.md
|
||||
* @since 0.0.3
|
||||
*/
|
||||
|
||||
namespace KW4NZ\Component\Depot\Administrator\Model;
|
||||
use Joomla\CMS\MVC\Model\AdminModel;
|
||||
|
||||
\defined('_JEXEC') or die;
|
||||
|
||||
class PartModel extends AdminModel
|
||||
{
|
||||
public function getForm($data = array(), $loadData = true)
|
||||
{
|
||||
$form = $this->loadForm('com_depot.part',
|
||||
'part', array('control' => 'jform',
|
||||
'load_data' => $loadData));
|
||||
|
||||
if (empty($form)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
return $form;
|
||||
}
|
||||
}
|
28
admin/src/View/Part/HtmlView.php
Normal file
28
admin/src/View/Part/HtmlView.php
Normal file
@ -0,0 +1,28 @@
|
||||
<?php
|
||||
/**
|
||||
* @package Depot.Administrator
|
||||
* @subpackage com_depot
|
||||
* @author Thomas Kuschel <thomas@kuschel.at>
|
||||
* @copyright (C) 2023 KW4NZ, <https://www.kuschel.at>
|
||||
* @license GNU General Public License version 2 or later; see LICENSE.md
|
||||
* @since 0.0.3
|
||||
*/
|
||||
|
||||
namespace KW4NZ\Component\Depot\Administrator\View\Part;
|
||||
use Joomla\CMS\MVC\View\HtmlView as BaseHtmlView;
|
||||
|
||||
\defined('_JEDEC') or die;
|
||||
|
||||
class HtmlView extends BaseHtmlView
|
||||
{
|
||||
protected $form;
|
||||
protected $item;
|
||||
|
||||
public function display($tpl = null)
|
||||
{
|
||||
$this->form = $this->get('Form');
|
||||
$this->item = $this->get('Item');
|
||||
|
||||
parent::display($tpl);
|
||||
}
|
||||
}
|
24
admin/tmpl/part/edit.php
Normal file
24
admin/tmpl/part/edit.php
Normal file
@ -0,0 +1,24 @@
|
||||
<?php
|
||||
/**
|
||||
* @package Depot.Administrator
|
||||
* @subpackage com_depot
|
||||
* @author Thomas Kuschel <thomas@kuschel.at>
|
||||
* @copyright (C) 2023 KW4NZ, <https://www.kuschel.at>
|
||||
* @license GNU General Public License version 2 or later; see LICENSE.md
|
||||
* @since 0.0.3
|
||||
*/
|
||||
use Joomla\CMS\HTML\HTMLHelper;
|
||||
|
||||
$wa = $this->document->getWebAssetManager();
|
||||
|
||||
$wa->useScript('keepalive');
|
||||
$wa->useScript('form.validate');
|
||||
?>
|
||||
<form action="<?= Route::_('index.php?option=com_depot&layout=edit&id=' . (int) $this->item->id); ?>"
|
||||
method="post" name="adminForm" id="item-form" class="form-validate">
|
||||
|
||||
<?= $this->form->renderField('title'); ?>
|
||||
|
||||
<input type="hidden" name="task" value="part.edit" />
|
||||
<?= HTMLHelper::_('form.token'); ?>
|
||||
</form>
|
Reference in New Issue
Block a user