mirror of
https://github.com/joomla-extensions/weblinks.git
synced 2024-12-25 01:45:59 +00:00
Add edit button to weblink details view
This commit is contained in:
parent
d18740065b
commit
efa61dea5b
@ -63,6 +63,8 @@ class HtmlView extends BaseHtmlView
|
||||
// Create a shortcut for $item.
|
||||
$item = $this->item;
|
||||
|
||||
$item->slug = $item->alias ? ($item->id . ':' . $item->alias) : $item->id;
|
||||
|
||||
$offset = $this->state->get('list.offset');
|
||||
|
||||
$app->triggerEvent('onContentPrepare', array('com_weblinks.weblink', &$item, &$item->params, $offset));
|
||||
|
@ -14,6 +14,15 @@ use Joomla\CMS\HTML\HTMLHelper;
|
||||
use Joomla\CMS\String\PunycodeHelper;
|
||||
|
||||
$weblinkUrl = PunycodeHelper::urlToUTF8($this->item->url);
|
||||
$user = Factory::getApplication()->getIdentity();
|
||||
|
||||
$canEdit = $user->authorise('core.edit', 'com_weblinks.category.' . $this->item->catid);
|
||||
|
||||
if (!$canEdit)
|
||||
{
|
||||
$canEditOwn = $user->authorise('core.edit.own', 'com_weblinks.category.' . $this->item->catid);
|
||||
$canEdit = $canEditOwn && $this->item->created_by == $user->id;
|
||||
}
|
||||
?>
|
||||
<div class="item-page">
|
||||
<meta itemprop="inLanguage" content="<?php echo ($this->item->language === '*') ? Factory::getApplication()->get('language') : $this->item->language; ?>" />
|
||||
@ -22,6 +31,15 @@ $weblinkUrl = PunycodeHelper::urlToUTF8($this->item->url);
|
||||
<?php echo $this->escape($this->item->title); ?>
|
||||
</h2>
|
||||
</div>
|
||||
<?php if ($canEdit) : ?>
|
||||
<div class="icons">
|
||||
<div class="float-end">
|
||||
<div>
|
||||
<?php echo HTMLHelper::_('weblinkicon.edit', $this->item, $this->item->params); ?>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<?php endif; ?>
|
||||
<?php // Content is generated by content plugin event "onContentAfterTitle" ?>
|
||||
<?php echo $this->item->event->afterDisplayTitle; ?>
|
||||
<?php // Content is generated by content plugin event "onContentBeforeDisplay" ?>
|
||||
|
Loading…
Reference in New Issue
Block a user