How or where is this variable defined in stencil?
{{ getFontsCollection }}
I'm hoping to include other google fonts in the theme. Are they automatically included if they are listed in schema.json?
According to the Stencil Docs, getFontsCollection is a handlebars injection helper function used to help you load the resource on the page:
{{getFontsCollection}}
The getFontsCollection helper is custom to Stencil. It returns a link tag that loads all selected font collections. It takes no parameters.
The helper method pulls from your global getThemeSettings() which are located in your config.json file. Look for the primary-font and secondary-font fields
"settings": {
"primary-font": "Google_Lato_700,400,300",
"secondary-font": "Google_Droid+Serif_400italic,400,700",
...
}
They are added via the config file
Related
I created a custom bundle (content type) and I've created fields
One of those field is a file type field, is a video file, stored in the private storage. I installed the videojs module to allow to watch the video.
I need to show this field twice in the node page. One in the generic file formatter that allows the user to download the file, and I also need to play the video. I decided to set up as generic file formatter and customize the twig template to show again with the video player.
I achieve to show twice with the settings formatter (generic file) with this code in the node--mybundle--full.html.twig template
{{ content.field_sd_video }}
I thought it would be something easy like field+formatter:
{{ content.field_sd_video|videojs_formatter }}
But I can't find what is the simple way to achieve this. May be it's necesary more a tricky way ?
I finally found the solution, I put this code in preprocess node function. It has to be easy, but not easy to know how ;)
function mytheme_preprocess_node(&$variables) {
$variables['video_caption'] = $variables['node']->get('field_video')
->view(array(
'label' => 'hidden',
'type' => 'videojs_player_list'
));
}
and I only has to add this line in twig file:
{{ video_caption }}
in my case node--mybundle--full.html.twig template
For those arrive here looking for something similar
I was inspired by Twig Recipes on page 41
It was usefull for me Twig debugging. Playing with kint and node variable and the classes used to wrap the information. Then I found that the field comes with [FileFieldItemList] and then I found the view method that uses [EntityViewBuilderInterface]
Is it possible to write custom handlebars helpers to use within Stencil templates? If so, where should they be defined? Is there an example somewhere within the documentation?
How/Where to use Custom Handlbars Helpers in Stencil?
All the helpers are predefined that can be used with Stencil "natively". If you'd like to register your own, you'd need to include handlebars as apart of your theme and create them clientside.
So My issue is this:
I don't know the process to theme inside regions in Drupal 8. I have the knowledge to theme regions by putting {{ page.XXX }} in the twig file (with regions declaration in the YML file) .But for example I have the "Content" region containing 2 blocks: Page Title and Main Page Content. How can I do to theme only the Page Title or the Main Page Content block in the twig file. Any help is most appreciated.
By default you can override the theme by any one of the below pattern
Pattern: block--[module|-delta]].html.twig
Base template: block.html.twig (base location: core/modules/block/templates/block.html.twig)
block--module--delta.html.twig
block--module.html.twig
block.html.twig
I installed django-cms and configured it according to the documentation.
The site comes up, but when I try to add a page I get an error:
TemplateDoesNotExist: INHERIT
I don't specify INHERIT as a template anywhere. It's finding my template directory ok, but I have no template named INHERIT and I don't know where that request is coming from.
Any help is greatly appreciated.
Can you check your TEMPLATES settings.
Looking through the source code:
By default template for a page set here:
TEMPLATE_DEFAULT = ... get_cms_setting('TEMPLATES')[0][0]
Source:
https://github.com/divio/django-cms/blob/develop/cms/models/pagemodel.py#L41
https://github.com/divio/django-cms/blob/develop/cms/models/pagemodel.py#L77
And looking through source code in utils/conf.py. A template named 'INHERIT' is added to list of available templates. And it looks like you own templates are not registered correctly and therefore the 'INHERIT' template is first item in the list.
https://github.com/divio/django-cms/blob/develop/cms/utils/conf.py#L99
https://github.com/divio/django-cms/blob/develop/cms/utils/conf.py#L136
I had failed to set the CMS_TEMPLATES as directed in the tutorial. (Actually, I had - but gremlins removed it).
Is any way to use Velocity DisplayTool in ODT template (rendered with XdocReport). I linked libraries with maven but when i render report from template I see tag $display.stripTags(Object), it seems that velocity does not recognize this tag.
Is there a need to make special configuration in xml, I use spring but I don't want velocity view resolver bean as it is in many solutions.
Ideas?
The $display variable will only be available within your template if you have added it to the velocity context.
There are 2 ways I know you can do this:
You can add an instance of the display tool to the context as a variable before rendering the template
You can create an xml configuration file and configure a ToolManager (example)