Show custom fields in category view

This commit is contained in:
Tuan Pham Ngoc 2021-08-17 19:59:53 +07:00
parent d569edd0dd
commit c4b4dfcc6f
3 changed files with 20 additions and 11 deletions

View File

@ -80,16 +80,11 @@ class WeblinksComponent extends MVCComponent implements CategoryServiceInterface
*/
public function validateSection($section, $item = null)
{
if (Factory::getApplication()->isClient('site'))
// On the front end we need to map some sections
if (Factory::getApplication()->isClient('site') && in_array($section, ['category', 'form']))
{
// On the front end we need to map some sections
switch ($section)
{
// Adding/Editing a weblink
case 'form':
$section = 'weblink';
break;
}
$section = 'weblink';
}
if ($section != 'weblink')

View File

@ -29,6 +29,14 @@ class HtmlView extends CategoryView
*/
protected $extension = 'com_weblinks';
/**
* Run the standard Joomla plugins
*
* @var boolean
* @since 4.0
*/
protected $runPlugins = true;
/**
* Execute and display a template script.
*

View File

@ -130,8 +130,8 @@ $listDirn = $this->escape($this->state->get('list.direction'));
$modalParams['modalWidth'] = 80;
echo HTMLHelper::_('bootstrap.renderModal', $modalId, $modalParams);
echo '<button type="button" class="btn btn-link" data-bs-toggle="modal" data-bs-target="#' . $modalId . '">
' . $item->title . '
</button>';
' . $item->title . '
</button>';
break;
default:
// Open in parent window
@ -146,6 +146,12 @@ $listDirn = $this->escape($this->state->get('list.direction'));
</div>
<?php endif; ?>
<?php // Content is generated by content plugin event "onContentAfterTitle" ?>
<?php echo $item->event->afterDisplayTitle; ?>
<?php // Content is generated by content plugin event "onContentBeforeDisplay" ?>
<?php echo $item->event->beforeDisplayContent; ?>
<?php if ($this->params->get('show_tags', 1) && !empty($item->tags->itemTags)) : ?>
<div class="mt-2 mb-2">
<?php echo LayoutHelper::render('joomla.content.tags', $item->tags->itemTags); ?>