Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Does not work in a matrix field #2

Open
vaughn-taylor opened this issue Jun 26, 2019 · 2 comments
Open

Does not work in a matrix field #2

vaughn-taylor opened this issue Jun 26, 2019 · 2 comments
Labels
bug Something isn't working

Comments

@vaughn-taylor
Copy link

I love the idea of this plugin, but it doesn't seem to work within my matrix field. I'm calling the plugin like this:

{{ craft.syntaxHighlighter.render(module.code) }}

Where "module" is my block, and "code" is the Syntax Highlighter field name.

I'm getting the following error:

Impossible to access an attribute ("type") on a null variable.

The plugin is functioning because it's outputting the following:

<pre class="code-container {% if setting.enableLineNumbers %}line-numbers{% endif %}" {% if setting.enableLineHighlight and field.highlightedLine is defined and field.highlightedLine %}data-line="{{ field.highlightedLine }}"{% endif %}>{% spaceless %}
<code class="language-{{ field.type }}">{{ field.code|escape }}</code>
{% endspaceless %}
</pre>
{% if field.caption %}
<div class="code-caption">
    <h6>{{ field.caption }}</h6>
</div>
{% endif %}
@hashtagerrors hashtagerrors added the bug Something isn't working label Jun 27, 2019
@hashtagerrors
Copy link
Collaborator

hashtagerrors commented Jun 27, 2019

It's strange because even the first issue reported that the plugin gives an error when used in a matrix. But when I use it (and still doing it) don't get any error. Therefore there's something that I am missing. {{ field. type }} echos the type of code that is selected in the code block. Does the field type work correctly when not used in matrix?

@kisonay
Copy link

kisonay commented Jul 15, 2019

Not that this helps but this plugin is working fine on my local development environment (laravel/valet) but I am running into issues on a production server (cpanel/whm based) per #1

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

3 participants