verbb / vizy

A flexible visual editor for Craft CMS
Other
43 stars 8 forks source link

Entry selection doesn't work with Typed Link Field within a Vizy block on multisite. #132

Closed wolf-em closed 1 year ago

wolf-em commented 2 years ago

Description

When using the sebastianlenz/linkfield plugin to render a link within the context of a Vizy field, selecting a related entry returns a null href attribute for the rendered link. This only seems to occur on multisite installations.

Steps to reproduce

  1. Add at least two sites to a Craft install
  2. Install Vizy and sebastianlenz/linkfield plugins
  3. Create a Vizy field
  4. Add a block that uses the link field.
  5. Add the Vizy field to an entry type
  6. Within the entry, add the link field and select another entry as the target url
  7. Render the template and test the link.

Additional info

Additional context

engram-design commented 2 years ago

I must be missing something, because I don't see any issue on my end with this?

image
{% for node in entry.vizyLink.all() %}
    {% if node.type == 'vizyBlock' %}
        {{ node.linkField.getLink() }}
    {% endif %}
{% endfor %}

Results in:

<a href="http://vizy.test/blog/test" target="_blank">Custom link text</a>
wolf-em commented 2 years ago

When the template uses the renderHtml() method to render the Vizy field containing a link block, the href attribute is empty. Only happens on multisite with entries added to at least two sites.

<div>
    {{ entry.pageContent.renderHtml() }}
</div>

<a href="{{ button }}" aria-label="{{ button.ariaLabel }}" target="{{ button.target }}">{{ button.customText }}</a>

engram-design commented 2 years ago

Hmm, I still can't replicate that. I don't suppose button.url makes a difference (it shouldn't)? Are the link field or Vizy field translatable? Is the entry you're linking to a different site to the one you're on? Is the entry with the Vizy field on the non-primary site?

What does a {{ dump(button) }} produce?

engram-design commented 1 year ago

Clsoing due to age