Release of v4.1.1-beta2
Adds new JCB package engine. Fix issue with loading the Component Builder Wiki. Adds advanced version update notice to the Component Builder Dashboard. Completely refactors the class that builds the Component Dashboard. #1134. Adds Initialize, Reset, and Push functionality to the Repository entities. Completely refactors the SQL teaks and SQL dump classes. Changes J4 fields to allow NULL. Fix a bug in Dynamic Get JavaScript that causes table columns to not load.
This commit is contained in:
@ -28,6 +28,60 @@ namespace ###NAMESPACEPREFIX###\Component\###ComponentNamespace###\Administrator
|
||||
#[\AllowDynamicProperties]
|
||||
class HtmlView extends BaseHtmlView
|
||||
{
|
||||
/**
|
||||
* @var array<string> List of icon identifiers to render in the dashboard view.
|
||||
* @since 1.6
|
||||
*/
|
||||
public array $icons = [];
|
||||
|
||||
/**
|
||||
* @var array<string> List of CSS file URLs to be added to the page.
|
||||
* @since 4.3
|
||||
*/
|
||||
public array $styles = [];
|
||||
|
||||
/**
|
||||
* @var array<string> List of JavaScript file URLs to be included on the page.
|
||||
* @since 4.3
|
||||
*/
|
||||
public array $scripts = [];
|
||||
|
||||
/**
|
||||
* @var array<int, object> List of contributor objects fetched via the helper.
|
||||
* @since 1.6
|
||||
*/
|
||||
public array $contributors = [];
|
||||
|
||||
/**
|
||||
* @var object|null The manifest metadata of the component as returned by `ComponentbuilderHelper::manifest()`.
|
||||
* @since 1.6
|
||||
*/
|
||||
public $manifest = null;
|
||||
|
||||
/**
|
||||
* @var string|null Markdown content of the component's wiki page.
|
||||
* @since 1.6
|
||||
*/
|
||||
public ?string $wiki = null;
|
||||
|
||||
/**
|
||||
* @var string|null The rendered or raw README markdown of the component.
|
||||
* @since 1.6
|
||||
*/
|
||||
public ?string $readme = null;
|
||||
|
||||
/**
|
||||
* @var string|null The current version of the component.
|
||||
* @since 1.6
|
||||
*/
|
||||
public ?string $version = null;
|
||||
|
||||
/**
|
||||
* @var string|null Help URL for the component dashboard view, if available.
|
||||
* @since 1.6
|
||||
*/
|
||||
public ?string $help_url = null;
|
||||
|
||||
/**
|
||||
* View display method
|
||||
*
|
||||
@ -71,18 +125,18 @@ class HtmlView extends BaseHtmlView
|
||||
protected function addToolbar(): void
|
||||
{
|
||||
$canDo = ###Component###Helper::getActions('###component###');
|
||||
ToolbarHelper::title(Text::_('COM_###COMPONENT###_DASHBOARD'), 'grid-2');
|
||||
Joomla___0c1a176a_304f_433a_8233_37d01ff87815___Power::title(Joomla___ba6326ef_cb79_4348_80f4_ab086082e3c5___Power::_('COM_###COMPONENT###_DASHBOARD'), 'grid-2');
|
||||
|
||||
// set help url for this view if found
|
||||
$this->help_url = ###Component###Helper::getHelpUrl('###component###');
|
||||
if (Super___1f28cb53_60d9_4db1_b517_3c7dc6b429ef___Power::check($this->help_url))
|
||||
{
|
||||
ToolbarHelper::help('COM_###COMPONENT###_HELP_MANAGER', false, $this->help_url);
|
||||
Joomla___0c1a176a_304f_433a_8233_37d01ff87815___Power::help('COM_###COMPONENT###_HELP_MANAGER', false, $this->help_url);
|
||||
}
|
||||
|
||||
if ($canDo->get('core.admin') || $canDo->get('core.options'))
|
||||
{
|
||||
ToolbarHelper::preferences('com_###component###');
|
||||
Joomla___0c1a176a_304f_433a_8233_37d01ff87815___Power::preferences('com_###component###');
|
||||
}
|
||||
}
|
||||
|
||||
@ -95,18 +149,22 @@ class HtmlView extends BaseHtmlView
|
||||
protected function _prepareDocument(): void
|
||||
{
|
||||
// set page title
|
||||
$this->getDocument()->setTitle(Text::_('COM_###COMPONENT###_DASHBOARD'));
|
||||
// add manifest to page JavaScript
|
||||
$this->getDocument()->addScriptDeclaration("var manifest = JSON.parse(" . json_encode($this->manifest) . ");", "text/javascript");
|
||||
$this->getDocument()->setTitle(Joomla___ba6326ef_cb79_4348_80f4_ab086082e3c5___Power::_('COM_###COMPONENT###_DASHBOARD'));
|
||||
/** \Joomla\CMS\WebAsset\WebAssetManager $wa */
|
||||
$wa = $this->getDocument()->getWebAssetManager();
|
||||
// Register the inline script with properly encoded JSON
|
||||
$wa->addInlineScript(
|
||||
'var manifest = ' . json_encode($this->manifest, JSON_UNESCAPED_SLASHES | JSON_UNESCAPED_UNICODE) . ';'
|
||||
);
|
||||
// add styles
|
||||
foreach ($this->styles as $style)
|
||||
{
|
||||
Html::_('stylesheet', $style, ['version' => 'auto']);
|
||||
Joomla___34690c75_1090_47eb_8c06_7228dc7eedd6___Power::_('stylesheet', $style, ['version' => 'auto']);
|
||||
}
|
||||
// add scripts
|
||||
foreach ($this->scripts as $script)
|
||||
{
|
||||
Html::_('script', $script, ['version' => 'auto']);
|
||||
Joomla___34690c75_1090_47eb_8c06_7228dc7eedd6___Power::_('script', $script, ['version' => 'auto']);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user