Issue #514Opened November 13, 2017by krunal0390 reactions

template/ Blocks/ Components

Question

We have requirement to create custom templates for different areas and all templates has below 4 variables anchor link, anchor target, image source, image hover text, title. We want to create one custom component and it will provide mechanism to select variables via traits. Is there way to provide template via block and use that under custom component rather than generation template in component?

We want to decouple component and block so block will provide template(i.e attached image) and component will replace placeholder with user selected values?

capture

Answers (2)

artfNovember 14, 20170 reactions

Well, with data-gjs-* attribute you can even use objects (JSONs)

content: '<div class="cls" data-gjs-attrobj='{"valid":"json"}'></div>',

but, for bigger templates, I'd recommend block definition via an object instead

    
    content: {
          // Just model's properties
          draggable: false,
          traits: ...
          ...
          // It's ok also using a string, components: `<div ...>...`
          components: [{
                type: 'text',
                content: 'Text here'
            }, ...
          ]
    },
lock[bot]September 18, 20190 reactions

This thread has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.

Related Questions and Answers

Continue research with similar issue discussions.

Paid Plugins That Match This Issue

Curated by issue keywords and label relevance to help you ship faster.

View all plugins

Loading paid plugin recommendations...

Browse Plugin Categories

Jump directly to plugin category pages on the marketplace.