Custom Links in Subparts

Help for integrating the Laravel package
Forum rules
Always add your Laravel, Aimeos and PHP version as well as your environment (Linux/Mac/Win)
Spam and unrelated posts will be removed immediately!
jafo66
Posts: 26
Joined: 06 Mar 2024, 04:42

Custom Links in Subparts

Post by jafo66 » 16 Apr 2024, 13:59

I have a created a subpart that lists related values. I would like to redirect the user when they click on the list to the item panel I created in a different location. Using the template code there is a link creation function:

Code: Select all

$enc->attr( $this->link( 'admin/jqadm/url/get', ['id' => $itemId] + $params ) )
that generates a link to the parent and not to the subpart.

How would generate a site safe link that takes me to another area in the admin application? Example: the link above generates to this: http://localhost:8000/admin/default/jqadm/get/season/6?locale=en. How would generate it to go here: http://localhost:8000/admin/default/jqadm/get/league/6?locale=en

NOTE: https://aimeos.org/docs/2023.x/infrastr ... view/#link didn't seem to provide any guidance.

Maybe another way to ask... is there an existing method to get the host and site?

Thanks

Code: Select all

Php version: 8.2.15

Versions: 
aimeos/ai-laravel                  2023.10.5  
aimeos/aimeos-laravel              2023.10.8  
inertiajs/inertia-laravel          v0.6.11    
laravel/framework                  v10.48.3   
laravel/jetstream                  v4.3.1     
laravel/serializable-closure       v1.3.3     
spatie/laravel-ignition            2.4.2      

User avatar
aimeos
Administrator
Posts: 7906
Joined: 01 Jan 1970, 00:00

Re: Custom Links in Subparts

Post by aimeos » 17 Apr 2024, 08:06

Use the correct resource parameter and the ID of the subpart as URL fragement:

Code: Select all

$enc->attr( $this->link( 'admin/jqadm/url/get', ['resource' => 'season', 'id' => $itemId] + $params, [], ['subpart-html-node-id'] ) )
See: https://aimeos.org/docs/latest/infrastr ... view/#link
Professional support and custom implementation are available at Aimeos.com
If you like Aimeos, Image give us a star

jafo66
Posts: 26
Joined: 06 Mar 2024, 04:42

Re: Custom Links in Subparts

Post by jafo66 » 17 Apr 2024, 20:50

That worked for what I needed, but how would you link to a subpart using that method? The link that got generated had the subpart ID at the end which didn't seem to work, but I might have missed something in the routing.

Example link created:
http://localhost:8000/admin/jqadm/<panel name>/get/<id>

Wondering how you would get this:
http://localhost:8000/admin/jqadm/<panel name>/<subpanel name>/get/<id>

User avatar
aimeos
Administrator
Posts: 7906
Joined: 01 Jan 1970, 00:00

Re: Custom Links in Subparts

Post by aimeos » 19 Apr 2024, 12:44

Like said, the subpart can be linked to be adding its ID as URL fragment, e.g.:

Code: Select all

<div id="league">...</div>

http://localhost:8000/admin/jqadm/season/get/1#league
Professional support and custom implementation are available at Aimeos.com
If you like Aimeos, Image give us a star

Post Reply