Skip to content

RTE page links are not resolved when an RTE field is used through Pro Variables #5378

Description

@red-sea-studio

ExpressionEngine version: 7.5.26
RTE version: 2.2.0
Pro Variables version: 5.0.3

When an RTE field is used as a Pro Variables variable, internal page links are stored correctly as page tokens—for example:

<a href="{page_181}">3 ways to save</a>

When the variable is reopened in the control panel, the RTE correctly displays the human-readable URI. However, outputting the variable through Pro Variables leaves {page_181} unresolved in the rendered HTML.

Steps to reproduce:

  1. Create a Pro Variables variable using the RTE fieldtype.
  2. Add a link to an internal EE page.
  3. Save the variable.
  4. Output it using {exp:pro_variables:single var="variable_name"}.
  5. Inspect the rendered link.

Expected result:

The stored {page_ID} token is converted back into the page URL.

Actual result:

The rendered href remains {page_ID}.

The RTE fieldtype’s save() method intentionally calls RteHelper::replacePageUrls(), while pre_process() calls RteHelper::replacePageTags() to reverse the conversion.

RTE already contains this variable-specific method:

public function var_display_tag($data)
{
    return $this->replace_tag($this->pre_process($data));
}

However, Pro Variables’ bridge checks for var_replace_tag(), then the legacy display_var_tag(). Because neither exists on the RTE fieldtype, it falls back to the ordinary replace_tag() method. That method does not call pre_process(), so the page tokens remain unresolved.

A possible fix is to add a compatible method to the RTE fieldtype:

public function var_replace_tag($data, $params = array(), $tagdata = false)
{
    return $this->replace_tag(
        $this->pre_process($data),
        $params,
        $tagdata
    );
}

Alternatively, the Pro Variables bridge could explicitly recognize the existing RTE var_display_tag() convention.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions