GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — SyliusCmsPlugin/doc/twig-functions-in-admin.md at master · tulik/SyliusCmsPlugin

Expand file tree

/

twig-functions-in-admin.md

Copy path
More file actions
More file actions

Latest commit

 

History

History
History
27 lines (19 loc) · 1.15 KB
/

twig-functions-in-admin.md

Copy path

File metadata and controls

27 lines (19 loc) · 1.15 KB
Raw
Copy raw file
Download raw file
Edit and raw actions

Using Twig functions in admin panel

With CMS 2.0+, you can use some Twig functions in the admin panel content. It's extremely helpful if you wish to render a block within a page, or what's even more common - a media, for instance an image or video.

So far, only following functions are allowed:

parameters:
    bitbag_cms.twig.admin_functions:
        - bitbag_cms_render_block
        - bitbag_cms_render_media

As this is a parameter, you can easily customize its value in your config.yml.

Note:

With the parser, you are supposed to use the function with {{ function_name('foo', 'bar') }} format. All characters, including spaces and apostrophes are recognized. Only string parameters are allowed.

If for some reason the function would not be able to execute, an empty string result will be returned.

To render the interpretable content, you need to use a special {{ bitbag_cms_render_content([resource]) }} Twig function. The resource needs to implement ContentableInterface. For an example, take a look at the Block's show.html.twig file.

You are visitor 01402792 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.