Code Monkey home page Code Monkey logo

Comments (7)

benjamminf avatar benjamminf commented on August 15, 2024

Cheers 👍

Absolutely, It's something I'm working on. For the most part it should work the same as Matrix fields. I'm working on having the template API be the same as entries in structures, so at the moment there's not a whole lot of support for handling child blocks. Fun fact though, you can use the {% nav %} tag to output a Neo field.

I actually haven't really advertised this plugin yet for this exact reason, but somehow people have found it, haha.

from craft-neo.

smockensturm avatar smockensturm commented on August 15, 2024

re: Templating. How do we get to, loop through and render the child blocks?

from craft-neo.

smockensturm avatar smockensturm commented on August 15, 2024

Right. If we use block.children we get ALL the children regardless of entry.

from craft-neo.

smockensturm avatar smockensturm commented on August 15, 2024

Here we go:

{% for block in entry.neoContentBlocks  %}
    {% if block.type == 'multiColumn' %}
    {% for col in block.children.ownerId(entry.id).type('column') %}
        ...
    {% endfor %}
    {% endif %}
{% endfor %}

where "multiColumn" is the parent and 'column' the children.

EDIT: nah. still get 'em all. the children don't know who their parent neoBlock is.

from craft-neo.

benjamminf avatar benjamminf commented on August 15, 2024

Hey @smockensturm sorry this has been trouble for you. Frustratingly this feature has been pretty hard to implement, but I've held back from advertising this plugin and writing the docs until it's implemented.

I've just released 1.0.2 which will let you get child blocks in the template, using a temporary API, just so it's usable in the meantime. This temporary API will remain supported throughout the 1.x version. You can now check the README on how to use Neo in your templates.

from craft-neo.

smockensturm avatar smockensturm commented on August 15, 2024

Fantastic! Works a charm. On behalf of our entire team, we thank you. Looking forward to what you get up to.

from craft-neo.

benjamminf avatar benjamminf commented on August 15, 2024

My pleasure, thanks for using the plugin!

from craft-neo.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.