• This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn more.

phraselink

Valhalla

Well-known member
#1
I need to trigger a change for an image in a similar way to how the state of a text link is changed (e.g. Watch / Unwatch). This would be for an small icon within forum_list.

I cannot use the existing phraselink data param to achieve this because it will only render text (with the link). I would not be able to render an image this way - at the moment, my phrase is the image html.

If the trigger returned the phraselink in as html(), instead of text(), it would display correctly.

I have considered registering my own function - AutoValidator :: ajaxSaveResponse - but I'm not sure how this would work with the existing one.

From xenforo.js:
Code:
$trigger
    .text(ajaxData.linkPhrase)
    .xfFadeIn(XenForo.speed.fast);
Code:
$trigger
    .html(ajaxData.iconLinkPhrase)
    .xfFadeIn(XenForo.speed.fast);
PHP:
$toggle = $this->_input->filterSingle('toggle', XenForo_Input::UINT);

if ($this->isConfirmedPost())
{
    if (!$toggle)
    {
        // thread_list
        return $this->responseRedirect(
            XenForo_ControllerResponse_Redirect::SUCCESS,
            XenForo_Link::buildPublicLink('forums', $forum),
            null,
            array('linkPhrase' => ($remove != 'delete' ? new XenForo_Phrase('remove_text') : new XenForo_Phrase('add_text')))
)
        );
    }
    else
    {
        // forum_list
        return $this->responseRedirect(
            XenForo_ControllerResponse_Redirect::SUCCESS,
            XenForo_Link::buildPublicLink('forums', $forum),
            null,
            array('iconLinkPhrase' => ($remove != 'delete' ? new XenForo_Phrase('remove_image') : new XenForo_Phrase('add_image')))
        );
    }
 
Last edited: