try to get it work

This commit is contained in:
Thomas Kuschel 2023-10-05 11:45:44 +02:00
parent f85556f466
commit 47796a6ada
8 changed files with 82 additions and 8 deletions

View File

@ -0,0 +1,16 @@
<?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\MVC\Controller\FormController;
class PartController extends FormController
{
}

View File

@ -0,0 +1,29 @@
<?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 DepotModel extends AdminModel
{
public function getForm($data = [], $loadData = true)
{
$form = $this->loadForm('com_depot.part', 'part', ['control' => 'jform', 'load_data' => $loadData]);
if (empty($form)) {
return false;
}
return $form;
}
}

View File

@ -26,4 +26,4 @@ class PartModel extends AdminModel
return $form; return $form;
} }
} }

View 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.2
*/
namespace KW4NZ\Component\Depot\Administrator\Table;
use Joomla\CMS\Table\Table;
use Joomla\Database\DatabaseDriver;
\defined('_JEXEC') or die;
class DepotTable extends Table
{
function __construct(DatabaseDriver $db)
{
parent::__construct('#__depot', 'id', $db);
}
}

View File

@ -21,4 +21,4 @@ class PartTable extends Table
{ {
parent::__construct('#__depot', 'id', $db); parent::__construct('#__depot', 'id', $db);
} }
} }

View File

@ -0,0 +1 @@
<h2>Welcome to my Depot Component - part!</h2>

View File

@ -8,17 +8,20 @@
* @since 0.0.3 * @since 0.0.3
*/ */
use Joomla\CMS\HTML\HTMLHelper; use Joomla\CMS\HTML\HTMLHelper;
use Joomla\CMS\Router\Route;
$wa = $this->document->getWebAssetManager(); //$wa = $this->document->getWebAssetManager();
//$wa->useScript('keepalive');
//$wa->useScript('form.validate');
HTMLHelper::('behavior.formvalidator');
HTMLHelper::('behavior.keepalive');
$wa->useScript('keepalive');
$wa->useScript('form.validate');
?> ?>
<form action="<?php echo Route::_('index.php?option=com_depot&layout=edit&id=' . (int) $this->item->id); ?>" <form action="<?php echo Route::_('index.php?option=com_depot&view=part&layout=edit&id=' . (int) $this->item->id); ?>"
method="post" name="adminForm" id="item-form" class="form-validate"> method="post" name="adminForm" id="item-form" class="form-validate">
<?php echo $this->form->renderField('component_name'); ?> <?php echo $this->form->renderField('titel'); ?>
<input type="hidden" name="task" value="part.edit" /> <input type="hidden" name="task" value="part.edit" />
<?= HTMLHelper::_('form.token'); ?> <?php echo HTMLHelper::_('form.token'); ?>
</form> </form>

View File

@ -9,3 +9,4 @@
*/ */
?> ?>
<h2>Welcome to my Depot Component!</h2> <h2>Welcome to my Depot Component!</h2>
Link: <a href="index.php?option=com_depot&view=part&layout=edit">Part</a>