Display Suite exportables

Video loading...

  • 0:00
    Display Suite for Drupal 7 - Display Suite Exportables
  • 0:03
    with Kristof De Jaeger
  • 0:04
    In this part, I'm going to talk about how you can
  • 0:07
    export all the settings that we have configured in our previous videos
  • 0:12
    to code.
  • 0:14
    So you can easily use this for going from development to staging,
  • 0:20
    from staging to life, and vice versa.
  • 0:23
    So for this exercise, I'm going to look at my full node.
  • 0:30
    So this is a full node.
  • 0:31
    I've configured it so that-- let me look at Layout,
  • 0:36
    Manage Display, Full Content.
  • 0:39
    So I've configured it like this with some stuff in two columns.
  • 0:44
    That Layout-- I'm sorry.
  • 0:45
    Author, Post date, Header, Left, Dynamic Field,
  • 0:49
    Right Image, and the Footer and the Comment-- has Comments.
  • 0:53
    And I've also disabled Drupal blocks and regions.
  • 0:58
    So I'm also going to export some other stuff.
  • 1:03
    So we're going to go and export this configuration setting.
  • 1:08
    I'm also going to export some fields.
  • 1:12
    So you can export fields as well.
  • 1:14
    I'm going to export a definition of the demo view mode.
  • 1:18
    And there was one else, but we'll see that in a minute.
  • 1:23
    So there are two ways to export.
  • 1:25
    You can either use features.
  • 1:28
    So the features module.
  • 1:31
    And then you can start clicking, and-- well, just
  • 1:36
    making your feature, of course.
  • 1:37
    So all the stuff that's exportable by Display Suite
  • 1:40
    will be available there, but you can also use the Bulk Exporter that
  • 1:44
    comes with the Chaos Tools package.
  • 1:46
    So in this place, we choose the CTools
  • 1:48
    for all managing of its objects.
  • 1:51
    So you can use that as well.
  • 1:53
    So I'm going to use that in this video.
  • 1:56
    So I've already enabled the Bulk Exporter.
  • 1:58
    It's a module in the CTools package.
  • 2:00
    If you click on that, you get a list of all objects
  • 2:03
    that CTools knows which can be exported.
  • 2:06
    So as you can see, there are field settings over here.
  • 2:08
    There are layout settings, view modes, and fields.
  • 2:13
    So I'm just going to override the full-- export
  • 2:19
    the full configuration.
  • 2:21
    So click those ones.
  • 2:24
    I am also going to export a demo view mode,
  • 2:27
    and I'm going to export the dynamic field because that's
  • 2:29
    the one I'm using in my full node.
  • 2:31
    So let's create a module name.
  • 2:34
    ds export.
  • 2:36
    Let's click on Export, and then you get a screen, which you can
  • 2:40
    just use to copy and paste stuff.
  • 2:42
    So let's create a module called "ds export."
  • 2:49
    And we have to create a file called "ds export.info."
  • 2:56
    So let me paste that.
  • 2:58
    I'm also going to put the package.
  • 3:01
    I'm going to rename it.
  • 3:02
    I'm going to put it in Display Suite.
  • 3:06
    Let's save this one, and then you have another file
  • 3:11
    that we have to create.
  • 3:13
    It's called "ds_export module."
  • 3:17
    So let's create that one. "ds_export module."
  • 3:22
    This is all stuff that comes from the Bulk Exporter in CTools,
  • 3:26
    so this is nothing that I have created for you.
  • 3:29
    It's just by default there.
  • 3:34
    And this is a configuration file with a lot of settings.
  • 3:38
    So as you can see, the configuration is in here.
  • 3:42
    The layouts are in here, view modes, and stuff like that.
  • 3:45
    Fields as well.
  • 3:46
    And you have to create a file called "vi ds export.ds.inc,"
  • 3:57
    and let's paste all this stuff in here.
  • 4:00
    So this is cool.
  • 4:02
    All settings are now in a file.
  • 4:04
    So we have now actually created a module with the exported settings,
  • 4:08
    and we just now have to enable it.
  • 4:10
    Now, for the demo purpose, I'm going to go to my php admin,
  • 4:15
    and I'm going to delete everything.
  • 4:17
    So Operations, empty the table, empty
  • 4:23
    its field settings, empty table.
  • 4:28
    Layout settings, empty the table.
  • 4:32
    And then in view modes, also Operations, empty table.
  • 4:38
    So let's go back to my website.
  • 4:41
    I'm just going to flush the cache first because there's still
  • 4:46
    some things that are in cache usually
  • 4:51
    so that everything is gone that I have configured before.
  • 4:54
    So there are a couple of other variables possibly
  • 4:57
    that are needed for the export.
  • 5:00
    Those things can be exported with Strongarm.
  • 5:02
    It's also a popular module that's used in features.
  • 5:06
    So not all variables are exported, but most things
  • 5:10
    are for Display Suite.
  • 5:11
    So I've now flushed my cache.
  • 5:13
    If I'm going to reload the screen again,
  • 5:16
    it should be my default Drupal core [INAUDIBLE] again.
  • 5:20
    So as you can see, there is nothing here.
  • 5:22
    If I would go to Display Suite and go to Layout, Manage Display,
  • 5:29
    you can see that there is nothing here.
  • 5:32
    Somehow, the demo is still leftover.
  • 5:35
    I don't know why that happens.
  • 5:38
    Let me just save this one again.
  • 5:40
    Maybe it will disappear.
  • 5:42
    And I think that's probably a Drupal core bug somehow.
  • 5:45
    I'm not sure about that.
  • 5:46
    Anyway, if I would go to view modes over here.
  • 5:50
    There are no view modes anymore.
  • 5:52
    There are no fields anymore.
  • 5:54
    So that's all save that back.
  • 6:00
    So we've created our module, and we've put
  • 6:03
    it in a package of Display Suite.
  • 6:06
    Somehow, it looks-- the info file is probably not OK,
  • 6:11
    but that's not a problem.
  • 6:12
    So let's enable this one and save configuration.
  • 6:18
    So now, Display Suite will import all the settings, true CTools
  • 6:22
    plug-ins, and the Export plug-in.
  • 6:25
    And we can just go back to our node if you'd like, and it should be OK.
  • 6:34
    Ta-da!
  • 6:35
    So this is really cool.
  • 6:36
    This is really, really handy.
  • 6:38
    So what happens right now is that you will also see field.
  • 6:42
    So the fields is over here.
  • 6:44
    If I would override this one-- so let's
  • 6:46
    say let's also enable our own taxonomy term-- then you will
  • 6:51
    actually see the operation here.
  • 6:53
    Normally, you would have seen edit over here.
  • 6:55
    Now, it's revert.
  • 6:56
    So the system internally knows that the stuff is overridden by you,
  • 7:05
    and you just can revert it.
  • 7:06
    Same goes for view modes.
  • 7:08
    So you don't really change a lot on view modes.
  • 7:13
    Demo 2, you can only like change that label
  • 7:16
    and the entities it's going to apply on.
  • 7:19
    So let's save it.
  • 7:20
    Again, you see here the revert.
  • 7:22
    So the most important part, I think-- if we would
  • 7:26
    go to Layout and Manage Display.
  • 7:29
    So default is still empty, as you can see.
  • 7:32
    Now, somehow, Drupal core knows that Demo has disappeared.
  • 7:35
    And now, it's Demo 2.
  • 7:36
    Also, the label has changed over here as well.
  • 7:40
    This is full content, so I've just really ordered the full content.
  • 7:45
    Actually, in the previous screen, I've showed you the default.
  • 7:49
    I can assure it was empty, but now it's there again.
  • 7:53
    So we can, of course, override this you'd like.
  • 7:56
    So let's go to disabled.
  • 8:00
    Let's move this as well and hit Save.
  • 8:08
    Do I have my node open here?
  • 8:09
    No.
  • 8:10
    I do not.
  • 8:11
    So let's go back to my full node.
  • 8:15
    So now, the Author and the Post Date are gone.
  • 8:19
    So you can also hide this node.
  • 8:23
    We can also remove this and hit Save.
  • 8:27
    And now, the blocks will be back.
  • 8:29
    So as you might have seen a few minutes ago,
  • 8:35
    Display Suite knows-- thanks to CTools--
  • 8:38
    that this configuration has been overridden.
  • 8:40
    And there is actually a message over here that allows
  • 8:44
    us to revert to default settings.
  • 8:46
    So we can do that.
  • 8:47
    Let's do it.
  • 8:50
    It asks you if you really want that.
  • 8:52
    And you can click on revert, and it will go back to the settings
  • 8:55
    that are done in the module.
  • 8:59
    So it now brings back the default settings.
  • 9:02
    So blocks are, again, enabled.
  • 9:06
    The-- oh, I'm sorry.
  • 9:08
    Let's go back here.
  • 9:11
    And there we go.
  • 9:11
    So that's how you export things with Display Suite.
  • 9:15
    Well, it's not with Display Suite.
  • 9:17
    It's just the power of CTools and the Export function.
  • 9:20
    Or if you like, you can also use Features.
  • 9:23
    So this was the last part.
  • 9:25
    Thank you for watching.
  • 9:26
    And hopefully, you have a good time with using Display Suite.
  • 9:29
    Thank you.
Loading ...

Display Suite Exportables

Loading...

In this lesson we cover how all over the configurations we have learned using Display Suite are able to be exported to code. This video shows how to do this using CTool but can also be done with Features as well.

Additional resources: