1

How can I make a custom layout with the Display Suite module in Drupal 8?

I checked the example for Drupal 8, but that didn't work for me.

Could anyone help me?

4
  • 1
    FYI DS should only be used for testing purposes, it's not ready for production. Are you getting errors or are you just asking how to do it? Commented Jun 19, 2015 at 0:55
  • Hi patrick, i implement in same way as in d7 like in theme folder sub dir with layouts but nothing happened no error or warning seems display suite not detecting custom layout but not sure. Actually i need to migrate d6 custom layout to d8. Thanks Commented Jun 19, 2015 at 8:34
  • "Display Suite for drupal 8 requires at least alpha 4 of the layout plugin module." Commented Jun 19, 2015 at 14:58
  • I am using layout plugin alpha 10. Now I just created custom module for Custom layout it works with Page_Manager. I found one example in layout_plugin module. But not with DS... Commented Jun 19, 2015 at 15:51

1 Answer 1

4

In your theme folder, create a THEMENAME.layouts.yml file:

clean_empty:
  label: Clean empty page layout
  category: Display Suite
  class: '\Drupal\ds\Plugin\DsLayout'
  type: partial
  template: templates/nodes/clean-empty
  regions:
    title:
          label: Title
    ds_content:
      label: Content

Then just create your twig file. In this example, create a clean-empty.html.twig file inside THEME/templates/nodes:

{#
/**
 * @file
 * Custom display suite layout
 *
 * Available variables:
 * - title
 * - ds_content: content region
 */
#}
{{ title_suffix.contextual_links }}
<h1>{{ title }}</h1>
{{ ds_content }}

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.