0

While creating my Custom Component i'm struggeling now on creating menu items for my views. The views are available via "/index.php?option=com_mycomponent&view=items" or "/index.php?option=com_mycomponent&view=item". But when trying to define a menu type inside the template the item will be available and can be saved but the link in frontend only shows "https://joomla4.local" the link column in the menu table shows the correct link:

index.php?option=com_mycomponent&view=items

enter image description here

See ID 224

My default.xml

<?xml version="1.0" encoding="utf-8"?>

<metadata>
    <layout title="COM_EQUIPMENTMANAGER_ITEMS_VIEW_DEFAULT_TITLE">
        <message>
            <![CDATA[COM_EQUIPMENTMANAGER_ITEMS_VIEW_DEFAULT_DESC]]>
        </message>
    </layout>
</metadata>

I do not understand - its still all very basic (the views only shows a fixed text string at this point) - did i missed a link definition somewhere in my code? I reviewed it now several times and checked with another of my extensions but i cannot see where the difference is neither I have no clue what i have to search for.

Repository can be found here: https://github.com/marcorensch/EquipmentManagerComponent/tree/implement_site_menu

1 Answer 1

1

Ok got it now - i had a mixup between my already copmpleted component (which i've used as "template") and the PHPStorm Component Project Template. In the PHPStorm Template the Router for SEF is already prepared to been used but i had some missing files for it to work - so i commented out the Router things from the code and it works now - as i thought a really dumb mistake. Leave it here for readers in the future ;-)

Changed: administrator/componentname/services/provider

commented out in register function:
$container->registerServiceProvider(new RouterFactory('\\You\\Component\\Componentname'));

commented in set:
$component->setRouterFactory($container->get(RouterFactoryInterface::class));

Changed in: administrator/componentname/src/Extension/Extensionname.php

removed implementation of RouterServiceInterface
usage of RouterServiceTrait

This was a learning for sure...

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.