10 years ago
Topic

Hello

It seems a before render code field, even If I modify the $fields['my_canonical_plugin_field']->options2 , has no effect on the HTML generated.

How can we dynamically change the itemid of the canonical plugin field please ?

thanks

Une petite mise à jour en Français (si ça peut aider...):

Je n'arrive pas à modifier dynamiquement le comportement du plugin de champ CANONIQUE avec un champ code 'après le rendu'. Meme si je modifie $fields['mon_champ_canonique']->options2, la page HTML générée ne prend pas en compte la modification. Le code arrive trop tot (ou trop tard ) ?

C'est important car, puisque le champ canonique n'est pas stocké en base, il est necessaire de pouvoir le changer dynamiquement (selon la valeur d'un autre champ stocké en base) car on ne peut se contenter d'avoir le même element de menu canonique pour tous les contenus d'un même type.

merci

cyril

Get a VIP membership
10 years ago
5
Level 1

Hi Cyril,

The beforeRender plug-in doesn't have effect on the canonical plug-in.

One way could be to create more that one field, and apply a restriction on it. (for example, to route to a different menu item per language)
Of course this is not practical if you have a lot of different menu items.

The 2nd way.. better if you have many items (not available yet but soon on the Link plug-in, and will be the same on the Canonical one) is indeed to set dynamically the Menu Item ID based on the fields' value. For example, you'd be able to map a Category ID to a Menu Item...

Regards,
Saba.

10 years ago
4
Level 2

Hi Saba

Thanks for the answer. the second solution is what I tried, without success though. 

In the canonical plugin I set the content value to FIELD (instead of current page) hoping I could set the alias of another field that would contain the menuitem but it doesn't seem to work that way!

Did I forgot something ? Did you mean this function doesn't work on the existing canonical plugin we have on the market ?

thanks

cyril

10 years ago
3
Level 3

Hi Cyril,

I'll try to send you an updated version tomorrow. This one will include the mapping feature..... i.e. for example: on menu item per category.

(directly mapped on the field configuration..)

If this is not enough for your needs (and you need custom code to be processed), I may suggest to add the $doc->addHeadLink(...) directly to your template/positions/variations...


Regards,
Saba.

10 years ago
2
Level 4

Hi Saba

thanks for this update

I 'm not sure this will do the job 

ALL we need is ... being able to set an external field in the canonical field plugin configuration. This external field will store the itemID, that's all !

thanks

cyril

10 years ago
1
Level 5

Hi Cyril,

So.. yes we could also have the option to select a specific field.. to set the Itemid... the same way that we have it for the PK (primary key) of the content.

It's actually easier to implement than the mapping feature... but also less flexible.

I let you know.

Regards,
Saba.

10 years ago
0
Level 6

Hi Saba

we already developped the mapping feature in the LINK plugin we sent you a few months ago. It allows you to map an itemid to a content typeor  a category. 

As for the canonical feature, as long as we can assign one itemid to one content, it's ok.

in the content type, int eh admin/site view we have a stored itemID field we want to fill into the canonical plugin in the content view.

thanks

cyril

10 years ago
0
Level 1

Hi Saba

No news from you for a few days?

thanks

cyril

10 years ago
0
Level 1

Hi there

I thought VIP forums were there to bring better answers than common forums. Saba, am I wrong or you claimed you were about to deliver a new canonical plugin to solve this issue please? 

thanks

Cyril

10 years ago
0
Level 1

Hi guys,

Cyril already got the updated plug-in, but for others... please note that it has been released... and is now available for download.

Regards,
Saba.

Get a Book for SEBLOD