DEL unnecessary code

This commit is contained in:
Thomas Kuschel 2023-10-06 04:47:51 +02:00
parent 7f79667409
commit 2b5e287a78
7 changed files with 22 additions and 99 deletions

View File

@ -17,14 +17,4 @@ use Joomla\CMS\MVC\Controller\BaseController;
class DisplayController extends BaseController class DisplayController extends BaseController
{ {
protected $default_view = 'parts'; protected $default_view = 'parts';
}
public function display($cachable = false, $urlparams = [])
{
$view = $this->input->get('view', $this->default_view);
$layout = $this->input->get('layout', 'default');
$id = $this->input->getInt('id');
return parent::display();
}
}

View File

@ -15,4 +15,4 @@ use Joomla\CMS\Extension\MVCComponent;
class DepotComponent extends MVCComponent class DepotComponent extends MVCComponent
{ {
} }

View File

@ -1,29 +0,0 @@
<?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

@ -1,24 +0,0 @@
<?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

@ -1,15 +1,19 @@
<?php <?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; namespace KW4NZ\Component\Depot\Administrator\View\Part;
defined('_JEXEC') or die; defined('_JEXEC') or die;
use Joomla\CMS\Factory; // use Joomla\CMS\MVC\View\GenericDataException;
use Joomla\CMS\Helper\ContentHelper;
use Joomla\CMS\Language\Text;
use Joomla\CMS\MVC\View\GenericDataException;
use Joomla\CMS\MVC\View\HtmlView as BaseHtmlView; use Joomla\CMS\MVC\View\HtmlView as BaseHtmlView;
use Joomla\CMS\Toolbar\Toolbar;
use Joomla\CMS\Toolbar\ToolbarHelper;
/** /**
* View to edit an article. * View to edit an article.
@ -32,20 +36,6 @@ class HtmlView extends BaseHtmlView
*/ */
protected $item; protected $item;
/**
* The model state
*
* @var object
*/
protected $state;
/**
* The actions the user is authorised to perform
*
* @var \JObject
*/
protected $canDo;
/** /**
* Execute and display a template script. * Execute and display a template script.
* *
@ -60,15 +50,11 @@ class HtmlView extends BaseHtmlView
{ {
$this->form = $this->get('Form'); $this->form = $this->get('Form');
$this->item = $this->get('Item'); $this->item = $this->get('Item');
$this->state = $this->get('State');
if (count($errors = $this->get('Errors'))) { // if (count($errors = $this->get('Errors'))) {
throw new GenericDataException(implode("\n", $errors), 500); // throw new GenericDataException(implode("\n", $errors), 500);
} // }
// $this->addToolbar();
return parent::display($tpl); return parent::display($tpl);
} }
} }

View File

@ -10,17 +10,16 @@
use Joomla\CMS\HTML\HTMLHelper; use Joomla\CMS\HTML\HTMLHelper;
use Joomla\CMS\Router\Route; use Joomla\CMS\Router\Route;
//$wa = $this->document->getWebAssetManager(); /** @var Joomla\CMS\WebAsset\WebAssetManager $wa */
//$wa->useScript('keepalive'); $wa = $this->document->getWebAssetManager();
//$wa->useScript('form.validate'); $wa->useScript('form.validate')
HTMLHelper::_('behavior.formvalidator'); ->useScript('keepalive');
HTMLHelper::_('behavior.keepalive');
?> ?>
<form action="<?php echo Route::_('index.php?option=com_depot&view=part&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('titel'); ?> <?php echo $this->form->renderField('component_name'); ?>
<input type="hidden" name="task" value="part.edit" /> <input type="hidden" name="task" value="part.edit" />
<?php echo HTMLHelper::_('form.token'); ?> <?php echo HTMLHelper::_('form.token'); ?>

View File

@ -9,4 +9,5 @@
*/ */
?> ?>
<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>
<p>Link: <a href="index.php?option=com_depot&view=part&layout=edit">Part</a></p>