Skip to main content

#100 Regarding the Title field

Posted in ‘NorrCompetition’
This is a public ticket

Everybody will be able to see its contents. Do not include usernames, passwords or any other sensitive information.

Environment Information (available for public)

PHP version
7.4

Latest post by webquality on Tuesday, 19 March 2024 22:45 EET

webquality

I understand that it is mandatory, but I want to add mandatory text in front.

Since it is this field that is entered when sharing on networks.

If the field is the participant's first name - example: Julien

In the Facebook share link it just displays: Julien

I want to display in front of another text like: Come and vote for

This would ensure that we maintain consistency in the rules of your components since the title field will still be used and unique.

But this could mean that when sharing on social networks, instead of just having the first name of the participant it would directly display: Come and vote for Julien

Which would be much more meaningful for the candidate's friends than just a photo and his first name.

b2z

In this case onOpenGraphPrepare is your friend. You will need to create a simple plugin to modify the title.

https://docs.norrnext.com/norrcompetition/customisation/events/other#onopengraphprepare

Something like this:

public function onOpenGraphPrepare($context, $item, $ogObject, &$options)
{
    if ($context != 'com_competition.participant' || !\Joomla\CMS\Factory::getApplication()->app->isClient('site'))
    {
        return;
    }

    $ogObject->title = 'Vote for ' . $item->title;
}

Kind regards,

Dmitrijs

webquality

Magnificent, I just created my first Joomla plugin ;)

Thanks a lot for your help.

 

https://postimg.cc/crW3hfyG

 

Support information

Support hours: You can get our help: Monday - Friday / 09:00 to 17:00 (GMT+3), but not limited. Our staff is pleased to provide Premium support to every paid subscriber asap, but sometimes you should be ready to wait for our reply for up to 3 days.


Our time: / Your time:

Support policy: We would like to kindly inform you that when using our support you have already agreed to the Support Policy which is part of our Terms of Service. We also ask you to remove temporary credentials at your site after the problem is resolved. Thank you.

Support of free extensions is not provided on this forum. Please submit your questions or report issues via Github tracker. See link on the product page.