1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

Can I add CSS to a YAML generated page ?

Discussion in 'Programming/Internet' started by Arthur Attout, Oct 8, 2018.

  1. (Sorry if that's Drupal 101, but I'm still at the very bottom of the learning curve ..)

    I have a custom module, with a routing file that redirects to a path that I have chosen arbitrarily :

    grefsearch:
    path: 'solr-search/content'
    defaults:
    _controller: '\Drupal\gref\Controller\GrefSearchController::search'
    requirements:
    _permission: 'use gref search'


    I have another YAML config which describes the View that must be rendered when accessing to solr-search/content :

    langcode: en
    status: true
    dependencies:
    ...
    page_1:
    display_plugin: page
    id: page_1
    display_title: Page
    position: 1
    display_options:
    display_extenders: { }
    path: solr-search/content
    cache:
    type: none
    defaults:
    cache: false
    cache_metadata:
    contexts:
    - 'languages:language_content'
    - 'languages:language_interface'
    - url
    - url.query_args
    cacheable: false
    max-age: -1
    tags:
    - 'config:field.storage.node.body'


    Since the page is completely YAML-based, I do not have a Twig template that is linked to it, and because of that, I cannot use hooks like template_preprocess_page because I cannot name the function properly.

    I'm a bit lost. Should I change the structure I have, and render the page in a Twig template anyway ? Thanks !

    Login To add answer/comment
     

Share This Page