Following this example: https://learn.getgrav.org/forms/blueprints/example-page-blueprint
I created my video.yaml file under "user/themes/MYTHEMENAME/blueprints", contents of its file:
title: Gallery
'#extends':
type: default
context: blueprints://pages
form:
fields:
tabs:
type: tabs
active: 1
fields:
gallery:
type: tab
title: Gallery
fields:
header.txf:
type: text
label: Add a number
default: 5
validate:
required: true
type: int
header.sb:
type: select
label: Select one of the following
default: one
options:
one: One
two: Two
three: Three
Cleared all caches, but i still don't see that tab under "/admin/pages" or "/admin/pages/home" advanced tab. What's wrong? Is it bug?
UPDATED INFO
"user/themes/MYTHEMENAME/MYTHEMENAME.yaml":
enabled: true
dropdown:
enabled: true
"user/config/site.yaml":
title: domain.org
author:
name: Name
email: 'email#mail.com'
metadata:
description: 'analytical news feed'
generator:
Tried to put them under "user/blueprints/pages/" - still not EFFECT! Why such an easy tasks is too complicated in grav...
Your blueprint is correct, it works on my side.
You said you don't see that tab under "/admin/pages" or "/admin/pages/home". This is not how a blueprint works, blueprint is only available for its page template. You didn't mention any sample paths of your page so it seems your page use a different template.
If your blueprint is user/themes/yourtheme/blueprints/video.yaml, it is only available for the pages which use video template, for example user/pages/home/video.md. Your blueprint will not available to all pages on the site.
Similar to modular template, you need to put your blueprint in modular folder: user/themes/yourtheme/blueprints/modular/video.yaml, and your modular page needs to use that template as well user/pages/home/_myvideo/video.md
Related
I am building a Quarto Blog, in my post I am adding a image to, it shows in my post but at the homepage it gives a error as a thumbnail:
I tried in different ways to insert the image, all of them gave the same result:
Using the visual mode in RStudio
Using image: "An intro to chi-squared test.png in the .qmd header
Using ![](images/An%20intro%20to%20chi-squared%20test.png) inside my .qmd
After rendering each one, the image shows inside the post but does not as a thumbnail in my home, as shown in the figure above.
I got it! so I removed the image from inside the post but kept the image command in the post .qmd header.
image: "An intro to chi-squared test.png
Then in my main index.qmd file I added the following below listing:
fields: [image, date, title, description, categories,author]
So my header became:
---
title: "Blog"
about:
template: jolla
image-width: 70%
listing:
contents: posts
fields: [image, date, title, description, categories,author]
sort: "date desc"
type: default
categories: true
sort-ui: false
filter-ui: false
page-layout: full
title-block-banner: true
---
Now my blog looks like this:
This is not a duplicate of e.g. Referencing a template in Twig / Symfony2 because creating bundles as applications is deprecated/not recommended anymore and therefore the answer is not applicable anymore. How do I reference my own template in a Sylius grid?
What I tried:
1.
options:
template: "#App/Order/Grid/Field/channel.html.twig"
2.
options:
template: ":Order/Grid/Field:channel.html.twig"
3.
options:
template: "templates/Order/Grid/Field/channel.html.twig"
4.
options:
template: "Order/Grid/Field/channel.html.twig"
(I tried some of these on the basis of the documentation: https://docs.sylius.com/en/1.6/components_and_bundles/bundles/SyliusGridBundle/field_types.html#twig-twig , https://docs.sylius.com/en/1.6/components_and_bundles/bundles/SyliusGridBundle/your_first_grid.html)
In all cases it says the template was not found. Any ideas?
How do you create grid or customize them? For example, I am trying to customize Admin > Catalog > Options grid, so by this tutorial put these lines at the end of config/packages/_sylius.yaml file:
sylius_grid:
grids:
sylius_admin_product_option:
fields:
name:
type: twig
options:
template: "Grid/mytemplate.html.twig"
Secondly, I create folder "Order" in /templates, then "Grid" folder in "Order" dir, and then folder "Field" in "Grid" directory. There I create file "mytemplate.html.twig" with any content. Did you tried similar steps?
In D8, I have created a custom theme. Then, I created a view and assigned the same into a region. I see the view is not showing anywhere in the theme. To test further, I change the theme to Bartik and the view is showing in the Bartik theme. Can anyone suggest to me why the view is not appearing on my custom theme? Below are the codes for my custom theme:
//test.info.yml
name: Test
description: A custom theme
type: theme
core: 8.x
regions:
navigation: Navigation
header: Header
quote1: Quote1
content: Content
services: Services
works: Works
quote2: Quote2
blog: Blog
contact: Contact
footer: Footer
libraries:
- 'test/global-css'
- 'test/global-js'
below is the test.libraries.yml code
global-css:
css:
theme:
css/bootstrap-responsive.css: {}
css/style.css: {}
color/default.css: {}
global-js:
js:
js/jquery.js: {}
js/jquery.scrollTo.js: {}
js/jquery.nav.js: {}
js/jquery.localScroll.js: {}
js/bootstrap.js: {}
js/jquery.prettyPhoto.js: {}
js/isotope.js: {}
js/jquery.flexslider.js: {}
js/inview.js: {}
js/animate.js: {}
js/custom.js: {}
dependencies:
- core/jquery
Below is the code of page.html.twig:
{{ page.content }}
Note: I'm using Drupal version 8.7.3
You should be placing your view in the content region.
You can make sure of this by placing any other content on that specific region and seeing if it works. If it works, then see settings of your view.
Otherwise, see if your region is placed properly in your theme.
This article may help you.
Adding Regions to a Theme
Check the region Wich you assign the view block .and also check that the region printed on twig file.
When I create a custom entity using Drupal console:
drupal generate:entity:content
then Menu paths are generated by default and they work very nicely, i.e. in the Structure Menu there are two entries for Listing entities and for Managing the Custom entity, and it includes sub-menus for Manage Fields, Manage Form Display, and Mangage Display.
Now, to avoid cluttering the structure menu, I like to gather all custom enitites uf a module under a SystemController::systemAdminMenuBlockPage under a path
/admin/structure/myCustoModuleGroup/myCustomEntityType
This is easy by inserting 'myCustoModuleGroup' into the paths in the entity annotations and in MyCustomEntityHtmlRouteProvider. Then I update the base_route of the mymodule.links.task.yml
However, then all the submenus for Manage Fields, etc., disappear. This is probably because they no longer have the correct parent.
I would like to end up with Menu entries for:
structure->CustomModule->CustomEntity1Type->Manage Fields
structure->CustomModule->CustomEntity1Type->Manage Form Display
structure->CustomModule->CustomEntity1Type->Manage Display.
structure->CustomModule->CustomEntity2Type->Manage Fields
etc.
Has anybody been able to solve this? I assume there is a way to change the menu link parent in code, since it was certainly declared somewhere, but I cannot find it (spent a whole day trying).
I was able to get this working in custom_entity.links.menu.yml like this:
entity.custom_entity.fields:
title: 'Manage fields'
route_name: entity.custom_entity.field_ui_fields
description: 'Manage fields'
parent: entity.custom_entity.collection
weight: 1
entity.custom_entity.form-display:
title: 'Manage form display'
route_name: entity.entity_form_display.custom_entity.default
description: 'Manage form display'
parent: entity.custom_entity.collection
weight: 2
entity.custom_entity.display:
title: 'Manage display'
route_name: entity.entity_view_display.custom_entity.default
description: 'Manage display'
parent: entity.custom_entity.collection
weight: 3
I try to override layout template in Sonata Admin. I did all steps founded in official documentation, but my changes don`t work.
I did:
Copied from vendor appropriate template (standard_layout.html.twig) to app/Resources/SonataAdminBundle/views/. I will check if I override here template my changes applied to all of Admins in project (I want have this change only in one Admin)
In next step I created new file in my Bundle (Name/InfoBundle/Resources/views/JobOffer) and add there my custom template: findCandidate.html.twig. Below is content of this file:
https://gist.github.com/anonymous/5f4780a1ae8d7329cd91
Added to bundle service:
name_info.admin.offers:
class: Name\InfoBundle\Admin\JobOfferAdmin
tags:
- {name: sonata.admin, manager_type: orm, group: Info, label: Job offers}
arguments: [~, Name\Info\Entity\JobOffer, NameInfoBundle:JobOffer]
calls:
- [ setTemplate, [findCandidate, NameInfoBundle:JobOffer:findCandidate.html.twig]]
After that my changes are not applied. So probably I made mistake in services or maybe I have to call this template also in controller? I am not sure where I make mistake. Could anyone help me?
Probably you mistyped a template placeholder in setTemplate function.
Try to set it like:
calls:
- [setTemplate, [layout, NameInfoBundle:JobOffer:findCandidate.html.twig]]
It will change a standard_layout only for the selected admin.