mirror of
https://github.com/joomla-extensions/weblinks.git
synced 2024-12-26 01:57:30 +00:00
Support Custom Fields
This commit is contained in:
parent
a007ae9a2c
commit
02baa68d28
@ -20,7 +20,10 @@ use Joomla\CMS\Component\Router\RouterServiceInterface;
|
||||
use Joomla\CMS\Component\Router\RouterServiceTrait;
|
||||
use Joomla\CMS\Extension\BootableExtensionInterface;
|
||||
use Joomla\CMS\Extension\MVCComponent;
|
||||
use Joomla\CMS\Factory;
|
||||
use Joomla\CMS\Fields\FieldsServiceInterface;
|
||||
use Joomla\CMS\HTML\HTMLRegistryAwareTrait;
|
||||
use Joomla\CMS\Language\Text;
|
||||
use Joomla\CMS\Tag\TagServiceInterface;
|
||||
use Joomla\CMS\Tag\TagServiceTrait;
|
||||
use Joomla\Component\Weblinks\Administrator\Service\HTML\AdministratorService;
|
||||
@ -33,7 +36,7 @@ use Psr\Container\ContainerInterface;
|
||||
* @since 4.0.0
|
||||
*/
|
||||
class WeblinksComponent extends MVCComponent implements CategoryServiceInterface, AssociationServiceInterface,
|
||||
TagServiceInterface, RouterServiceInterface, BootableExtensionInterface
|
||||
TagServiceInterface, RouterServiceInterface, BootableExtensionInterface, FieldsServiceInterface
|
||||
{
|
||||
use CategoryServiceTrait;
|
||||
use AssociationServiceTrait;
|
||||
@ -64,6 +67,59 @@ class WeblinksComponent extends MVCComponent implements CategoryServiceInterface
|
||||
$this->getRegistry()->register('weblinkicon', new Icon($container->get(SiteApplication::class)));
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns a valid section for the given section. If it is not valid then null
|
||||
* is returned.
|
||||
*
|
||||
* @param string $section The section to get the mapping for
|
||||
* @param object $item The item
|
||||
*
|
||||
* @return string|null The new section
|
||||
*
|
||||
* @since 4.0.0
|
||||
*/
|
||||
public function validateSection($section, $item = null)
|
||||
{
|
||||
if (Factory::getApplication()->isClient('site'))
|
||||
{
|
||||
// On the front end we need to map some sections
|
||||
switch ($section)
|
||||
{
|
||||
// Adding/Editing a weblink
|
||||
case 'form':
|
||||
$section = 'weblink';
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if ($section != 'weblink')
|
||||
{
|
||||
// We don't know other sections
|
||||
return null;
|
||||
}
|
||||
|
||||
return $section;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns valid contexts
|
||||
*
|
||||
* @return array
|
||||
*
|
||||
* @since 4.0.0
|
||||
*/
|
||||
public function getContexts(): array
|
||||
{
|
||||
Factory::getLanguage()->load('com_weblinks', JPATH_ADMINISTRATOR);
|
||||
|
||||
$contexts = array(
|
||||
'com_weblinks.weblink' => Text::_('COM_WEBLINKS'),
|
||||
);
|
||||
|
||||
return $contexts;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Returns the table for the count items functions for the given section.
|
||||
*
|
||||
|
Loading…
Reference in New Issue
Block a user