 Here we go. We are in organic groups in in or you are in in organic groups. That's fun We're gonna talk about the d8 group module My name is Scott self. I'm a senior software engineer for mobo mo If you were happened to be at the NASA talk a little while ago same team Different team same company. I usually work on USGS most of my days Along with these guys of NASA. This is the kind of the snippet of mobo mo's profile in the federal space got a lot of commercial accounts as well For me, I live and work remotely from Birmingham. I'm a bomo is actually out of the DC area and rest in Virginia Married to my college sweetheart to two kids. She homeschools them. God bless her I Got a bachelor's and master's in French of all things and here I am now I Fancy myself a bit of a musician big fish head bluegrass And I am Scott self with one T one T on Twitter, I see triple org just about everywhere I have been working with Drupal about ten years started I did a handful of triple five sites a lot of six and mostly seven just get my feet wet with eight mostly Have been known to been in the country for space as well. So try and pitch in where I can So a little disclosure on where this talk came from or why I decided to do this talk Been working with organic groups on the USGS site for a little over two years Took me a while to figure out how long it had been because I asked a couple of people They're like, I don't know four or five years because that's how long it's felt but Only about two years apparently two years and a quarter maybe We talked about the the possibility of migrating to date in the future It's not a real thing But we just sort of open up the idea and so we're looking at you know One of the biggest things that would be important is how to manage the groups that we already have on us Just I govern how would we go about that in D8? Like can we even do it? So that's sort of where that started wasn't ever really asked to do it fully but this sort of gave me the impetus to start digging into it see what it might take I am not an expert on either module necessarily. I definitely a lot more a student OG but not by any means an expert I Will have some of the answers but not all of them if you have a good question I will try and get back to you later So And yeah, again, just to make sure you understand this is not like a organic groups versus group module Fight to the death kind of thing. Who's better? Who's worse? But this is just Some of the facts about both and then we're gonna just look more closely at the D8 version So why or why not organic groups? Let's do some pros and cons real quick real simple First of all, what do they both do well? They both have some sort of concept of what group is And how to relate content types and I should have put users as well as members I sort of did here by granting membership. So you have users that are members in a group They both have the idea of custom roles and permissions You know at a group level so you can define a group and they have their own that type of group has its own Set of permissions which are separate from Drupal permissions. They're obviously intertwined but And they neither of them make very many assumptions about what you're going to do with it So just some some real basic But powerful Uses just they don't tell you how to use it necessarily a lot of modules do I did a talk at Drupal Camp Atlanta about how we use text on any And organic groups kind of together In the USGS site. So if you're interested check this one out by that's animating again. Okay So D7 Organic groups pros. There's a lot a lot a lot of sites using it So that helps, you know with getting bug fixes quicker and you know how that works in the Drupal contrib space It has a pretty good developer Side of things has you know a lot of API functions that you can use Simple things like og group and og ungroup to put somebody or a piece of content in a group It is very it was very full-future It has you know groups have the roles and permissions like I mentioned you can actually with og you have the option to Allow an individual group say, you know, you've got a set of I Don't know libraries and they have each library branch has its set of default permissions But then each you can allow us an individual library say well, we want our permissions to be a little bit different Which is kind of a nice thing depends on how you look at it That's kind of where the word the organic part of organic groups came from It has lots of views integration. There's some default blocks that get shipped with it It does handle field level access and it integrates with like user registration forms So when you Are creating an account you can choose which groups you want to be involved in And there's a ton of contrib modules that go along with og All of which mentioned here we use on usgs.gov Some taxonomy how a group can have its own taxonomy and Manage those terms themselves and they're only available to them they have their own menus They can have their own workflows permissions for each workflow Skulled anybody use Skulled for media in here. Yeah, we love it usgs loves it. NASA loves it And there's this og integration for that module as well and it's It was among the hundred and six most downloaded modules for D7 this cool old chart that embassy labs built cons so Organic groups relies on fields fields making the reference to Either from the user to the content to the group or from the group to its content And I'm a title if he's here or not, but he's I've seen him walking around who wrote organic groups or most of it He himself, you know it called this abusing the field API. So There's also there's some things about the UX that are a little confusing so an example here in a second The whole field usage and then you have the configuration for all the group types is sort of It's out of place to me Another problem with d8 develop development seems to be stalled for you know, they're doing other things Which is you know kind of the nature of the contrib space Now this is the interface for the the fields when you can add fields to the to a group type or any kind of bundle If you've ever who here has used organic groups before it was you seven of most of you awesome Cool, so you know what this is like Geez what's that all about all right, whatever so I'm sure it'll be highlighting something here in a second So in d8 and again remember this is or G is really just d7 pretty much and then this group module is also Primarily d8 though it does have a d7 version I haven't checked it out, but we'll get back to that And d8 this new group module, which is mostly what we're going to talk about today The group itself Is a fieldable entity so it's you know first-class object just like any other entity in the system All right has a really great developer side API everything's object oriented plugins classes all the you know the new Drupalate goodness that we're learning to enjoy and love if you have if you're coming from a triple seven background and not a pure PHP background So we'll talk about this a little more in-depth in a second but there's a separate entity for the relationship between the group and the user and as well as the group and the content itself and a single group Cannot override the settings at a group type. So if you set up a group type to work a certain way Individual groups of that type do not have any way of Overriding so it always functions the way you set it up You can see they set this up here at the top as a top-level item And it's got all these tabs we can talk about in a second on the con side it was kind of hard to come up with as many as I thought I would but It does need a little UX love and I'd plan on if anybody feels like jumping in with me I'd love to spend some time on contrib Down on the sprints later to try and resolve some of these things most of them are small. So Some of the configuration leads to some Things that kind of make you go, you know scratch your head if you haven't run into this before and I'll go through that in a second Just some of the nomenclature in the wording You'll see what I mean in a second There is no integration currently with what you would call a config entity in d8. So things like menus and taxonomy and web forms that aren't True entities as it were they're not PHP entities. They're config entities And there is an open issue that they're working on that and also You know, I took the same point and turned it into con as well because if you want Individual groups of a certain type to be able to override what the setup is Default for that group type. You can't so I'll actually show this in a minute. So I'm gonna skip over that part I totally stole this from Mike and Olo. He has seen him walking around but this is from his Triple easy podcast the chart that he hid there. So right here in the middle. You've got your group How you're gonna create a group when you create a group You're obviously gonna want to relate the group to two things nodes or content of some sort all kinds of other entities probably and and users who have memberships in them so The way that group handles this is these sort of intermediate Relationship entities is what I prefer calling them They're actually calling them group. I say group node here. It should say group excuse me It should say group content. So they call this group content article or group content basic page Which again be clear? This is a separate entity from the node itself So there's the node the relationship entity and the group itself and Then back down the same thing down to users as well We'll talk a lot more about that But you kind of get the the idea of the structure of this and each one of these is fieldable Which makes for some interesting things you can do for like, you know So I want to when I sign up I want people to provide when I join this group I want somebody to be able to provide additional information about why they're joining I can say, you know You know, what's your what's your interest in this thing or There was one an example about like a video game like how good are you at this part of the game or whatever? You can do all kinds of things with this There's lots of good examples in the examples. I'll give you at the end here, too. So the question was Excuse me. Why are why not organic groups and the answer is really two parts? It's D7's probably is organic groups I'm sure the group module for D7. It's probably great. I just haven't a chance to try it But I do know that organic groups I think in my opinion has the leg up for D7 just because of the contrived Editions that you can get that are just covering just about everything you might run into that you want to Be handled by organic groups in the group strategy For D8, it's at this point hands-down group. There doesn't there isn't a stable version of OG for D8 yet Listen to the talk that Amitai gave in Baltimore, you know, I don't know if there will be a D8 organic groups. We'll see So demo fun times So I was just gonna spin one up this way everybody else has used anybody tried and simply test me, right? Anybody not use this thing pretty cool, right? So you can start out with a project name in this case we're gonna Base everything on our group module. I'm gonna get the latest development You can also add things like you know Excuse me for instance, I know I need token and I need an address field for this demo I'll use like inline entity form and you can keep filling this out all day long and put everything you want in there It's just gonna add them to your To the make file that it's using in the background to build this. I'm not gonna make you wait on this. I've already done this so We're just gonna log in All right, and then of course the first thing you got to do is enable these things because again all it does is put them in your in your build We're gonna enable two things group itself and then group node which as it says enables group functionality for nodes We'll talk a little more in depth about How that works in a second install those give them a second and It will have a top-level icon here. There was some discussion There's a good one of the links later. If you follow it see which one was that I don't remember which one There's quite I looked at so many things But one of them specifically he addresses why he put it here instead of where it might have gone structure or content or whatever I can ignore this for now because it just keeps coming up. So let's create a new group Well, we can't create a new group. We don't have any types, right? So In this case, I wanted to do the demo around the idea of like building a Like a music fan website. So something here you could log in and you know put in your favorite band or create a An album and you know somebody that didn't put an album up there or a show that they've played or something like that, right? You can be fans of this Okay, let's talk about these options quickly Okay, some of these are pretty obvious and everybody can see that pretty well or it's pretty small The first one says the group creator automatically becomes a member It's exactly what it says if you create a group you're automatically a member If that's checked you may or may not want that to be the case for the person who creates the group to be the member a member Great group creator must complete their membership So this goes back to What I was saying about this chart So as you're creating a piece of content a Node in this case of whatever content type we'll talk about in a second You're also going to be creating this relationship entity at the same time and so What they're saying here is when you create the node Or when you sorry when you create I told you the opposite part. This is the bottom part when I create the group This gets created right so this entity relationship gets created between me As the creator in the group now when I fill this out Do I want the person who's creating the group to have to complete their membership? and all that really means is You're gonna get another step after you create the note the band in this case to say I want to Here's another opportunity for them to define fields on that relationship So I could say you know how long have you been a fan something like that, right? And that could be something that's real. It's relevant to how the user ties to the group and That's all it's relevant for it's not relevant to the user outside of the group context, right? And it's not useful as to the group itself Unless you wanted to come up with a list of how long people have been You know fans of this group and you could come up with that then But I'm gonna leave this checked on purpose for the moment just to show you one of the little things It's sort of annoying that I hope to ask them to fix and maybe provide a patch for This third one automatically configure an administrative role It's exactly what it sounds like is there to be an admin role on this by default or not And then whether the group creator gets that admin role or not and obviously if this isn't done You can't do the fourth thing so that goes away. I'm gonna check them all for now So we're gonna create this group type. All right, cool So, of course, it looks just like, you know, your your content types, right? So we can manage fields on the band We can do Whatever we want here, of course I was gonna do something like Members, of course, this is gonna be unlimited and we'll just make it a simple text field and just ask them like include That way you don't have to fiddle with a field collection here for now That would be probably the better way to do it You always could add, you know, like a description field or whatever some sort of body to describe the So just like any old Content type now we have a group type of a band So let's look under here Wanted to do since I enabled it might as well use it So under groups now we have we can have a list of groups We're gonna add a group now because we can't actually let me let's take a step back real quick Let's look at the group types tab real quick So we've got a fully fieldable entity which we just filled with and you can of course manage the form display in the display You can edit which is just editing that band group type, which is that original form? We looked at before right or essentially the same form Then you have the permissions part which we talked briefly about earlier and I'll show you that in one second group roles and available content So if we just and you can actually if you go from the list, you know to a specific one you can see those So we got to create one first Actually, no, let me go back. Sorry. I should have done it from here So let's go right from here the the global permissions for this group type are set up right here by default so Yeah, again, you have admin role that got created by default when you create the group and Then you have these other three roles that get created by default no matter what anonymous is exactly what you think an Outsider is somebody logged in but not a member And then members a member and then of course you can have any number of custom roles that you like And as you go, of course this permissions page will grow for anything that you have Control over within the context of the group module Okay, so that's permissions and again like I said you can create roles just like you would at the Drupal level no difference They're just only valid within the context of this group type. So that makes sense All right, just like just like an og most of you've used og so that's kind of a new brainer All right, so let's go back to the list Let's create a new group anybody Whoever well, I wish I'd have moved that that always annoys me Am I know throw out a band that they know all the band members for and all their instruments come on come on Somebody likes music in here 311 all right 311 We're the band members. Let's see play Guitar, that's guitar. That's that's nice feel right there Guitar I Used to know this Okay, and peanut right Oh Let's call peanut in the base. Yes. He's just vocals. That's right. Who's the good chat? All right So we're gonna build a site around 311, you know They play awesome music Okay, so here's the first thing that's kind of interesting to think about When it comes to creating the groups themselves, so this is create band and complete your membership Remember how I checked that box at the beginning That said the group creator must complete their membership Okay, so that's where we're going now. So I'm gonna go complete. So now I'm on this screen now You tell me if you've ever you never used this before that this isn't like confusing because I Didn't know where I was the first four or five times. I tried this I was like am I Recreating the same alias for the node. I just created or what's going on here But it makes sense once you get it, but I was so lost going why am I on ad group again? And all I get is this URL fail alias field But point being to all that is that if you get a group type created that in fact, let's just show this really quick So for creating a group type whoops This to me and should be default off right and something more like if you Have fields you're gonna want to enable this right? So if you have fields on your because you're not by default can have any fields on your membership entity and when you're creating it at This point you definitely don't So to me you'd need to come back here and check that box versus the opposite But that's just my personal preference. I guess maybe maybe we'll get some advocates on the on the issue queue for that So that's what's going on there so I can Ignore this because it doesn't need an alias really Okay, so now I have a band so now I'm in This is the other thing that's a little weird because you created the Relationship entity and left it on a check to where you had to go to that screen and that was the last thing I did I'm actually looking at the relationship entity now, which is It really useful to me probably not in most cases. I don't think it's gonna be It's good to have you know that it's there and you know how to get at it from the group or from the user because fields and values But I always thought this was strange So you you're actually in related entities, which is the membership of the admin user in the 311 group Does that make sense? So I thought that was a little strange So now we have this 311 node No, it's the I even still did 311 group entity And you have this three three tabs on that, you know This one's got all related entities and then members and nodes automatically get their own separate tab Because that's why I did it now why I have two in here Maybe because I went forward as a couple of screens and back. I don't know. I have no idea what happened there Is there good to know all right, so And this is using the dev version, but if there's a patch I didn't didn't drop it in there So we'll definitely I'll definitely look into that Yeah, so this is members I've got two of them. I don't have any nodes yet Let's see if you do it from here We didn't get the dev version related entities back to here. So now you have two options. I can really have one Oh, right. Sorry. I skipped a step. Okay now. So let's go back to this part. Okay So the last thing I didn't cover here is this available content part This is important. That's why that last attempt to do something didn't work Okay, so this screen basically defines What content types are Going to get this new intermediate relationship entity Right now the only thing that has one is the user which is installed by default And I don't think you can really tell from here, but oh, yeah, you can the star there is always Always on so this module does not allow this particular plug-in to be turned off And that's what the group node module itself does is makes Nodes available as available content to the group types Talk about that a little more in one second But I'm just gonna install for now and in fact, let's do some let's do some content types that are a little more relevant So let's do something like a title of an album A body can be just a description and then we'll call this could go through and Put them in one at a time Whatever like that. Okay And then I'd like a show So if you wanted to put in something when they played put it on the set list tell how awesome the show was You could do stuff like that from our cool fan site, right? Show date Anybody else run into that before Okay, and then whatever we can build this out as much as we want to point being back to the group types available content Every node type is you know, but potentially something that we can tie to a group, right? So of course we want albums to be available as group content this is a similar thing that To the one before where you have this blank screen with just the or alias if you don't have any fields Almost the exact same thing here when I create a See if it shows me a group node album Entity which is what they're calling that relationship entity When I create that do I want to use the two-step wizard? Which means I'm gonna Get dropped off in this middle step to fill out the relationship entity and then end up in the relationship entity, right again the defaulted to checked I'm gonna uncheck it now because I don't plan on putting any any sort of metadata on the relationship, right? So that's That's I'm gonna go about this. There's other cobalt settings here that are kind of cool This just says how many basically how many albums can a band have This is one of those things where I think they're the wording could be a little bit better Like this is confusing the amount of band groups a single content entity can be added to as a group node album. I Just have a real hard time process in that personally Anyway, so this one is how many times can the same Entity in this case album be added to a Group as as an entity or as a member or whatever or have the relationship and this the group node plug-in Says this the one you can't really tell I don't think from there, but it's disabled Because you can't change that but some other providing Some other module providing a plug-in to get some other entity type available as As group content could allow you to tie the same Entity to this group twice Okay, that's a lot of talking Okay, cool. So now this one's Installed and you see it's installed And then notice like once it's installed you basically this is almost like you have another set of node types, right or Any sort of entity type So you've got this is the relationship entity to the user. So again, if I wanted to require somebody To say in this case So then I would go back to if I wanted to require that to be you know filled out as you're becoming a member. I Can't figure this. I think I guess the looks like the band when you actually don't have that choice Maybe that's what it was. Yeah That's all right. There you go. Yeah, so this is still checked. Oh, no, that's creating a band though. Yeah That's right. So if I go back to yeah, you're right Come back to here create a new group. We'll go with Rolling Stones because why not I'm for I'm sure Guitar guitar so again complete create the band and complete your membership And now we have this field to say however long you've been a fan. So again URL alias really doesn't have a lot of use in this particular You know use case or whatever so Let's go back to the available content And manage the form display on that and just get rid of that So that won't come up again The only thing they'll have to fill out next time when they create a band is how long they've been a fan. That's it, right? Any questions so far we pause for just a second and see if there's any questions And get some water All right, so back to the beginning real quick just to recap here and then I'll go back to the demo side. So we've got You know obviously have to create you turn it on Had a group you can't because there's no group types. Of course you have to create a group type Again with the if the membership has no fields when you're creating a group And your your user is gonna have to create a membership. That's just means you probably want to uncheck that just that's Important config my for me and it changes the the button text when you create the thing too So if that's unchecked it just says create band and become a member if it skips that to to the two-step wizard So you again you have to install a Content type or an entity type or bundle I guess we'll have to How do I say this so a module can define which entity types are Available as group content and you can then install them as group content one at a time just saying hey Let me create me an entity relationship between the two and then you have these configuration options when you create that and Then you of course you can uninstall something so uninstalling Really all it says is get rid of the membership entity between the two things right so Articles or even you know in our case albums or shows are just Normal nodes now they don't have any sort of relationship to The group band type Once you uninstall them. I don't know if it deletes all those entity Relationship entities in the database. I've meant to look into that, but I don't know This is right here was just an example. I found on one of Christian Vanden Einde is the one who actually wrote group who's with decent out of the UK So a big shout out to him for writing all this. It's really really solid but he Gave this example here of how you can extend it to another Entity type so for an example you've got you know group node provides the integration with nodes obviously Well the way this plug-in Works is all you have to do is this few lines of code right here with this annotation I forget what they called it. Somebody told me the name of yesterday of a space annotation based plug-in and So like all your configs up here in the comment And then you're just extending the group content enabler base And so this is just for instance show making commerce products Something that you better is it is a group content so theoretically you could have you know products They're only available to the groups and that kind of thing We talked about permissions and roles You have so every time you install a plug-in for a content type for albums and shows like we did Each one of those of course is going to add to your permission screen. So you've got view edit delete any and own For each content type that gets enabled as well as the relationship entity between them So you can really control who has access to what? Related entities we briefly touched on Let me see if we can just look at that one more time In this case all we can do at the moment is relate an existing entity to a group Probably because there are no nodes obviously we haven't created any so Let's create a new album. So that's one of three eleven's albums. We'll leave it at that I don't know any of the track names doesn't matter Now I created this node outside of that group, you know right now that group doesn't know anything about this album So this is I'm going to be able to relate an existing entity So I don't want to relate a new user. I want to relate an album And you got your nice little autocomplete Maybe oh the title Thank you Yeah, so we're creating that Relationship to the between the two so so from the related entities dad now you've got you know visibility of the music's album and You should be able to create a new entity and I know it was the permissions which we didn't touch So let's fix some of those permissions types I Notice this Sort of annoying it doesn't work the same way as some of the other things The admin role even though it's supposed to have everything when you enable new content Types or whatever install them install the plug-in for the relationship. You don't automatically get those permissions So it might be something to look at as well Of course So now I can relate I can create a new entity in the group as well as relate existing entities And in fact I may have been wrong about the permissions and it was just a cash all along But we do need to set up the permissions right anyways Don't forget to visit your per local permission screen when it becomes necessary Right so we can create a new one and this does both steps at once right So this is really what you want to do is to create it from the group itself You'll notice That did both at once again if we had that that intermediate step where there was some definition of you know What the relationship of that album was to 311 you could have fields on that relationship and that would have popped up And then we would have filled that out first All right, so that's related content Relating existing entity you can add members this way second member additional members yet, so That's the majority of now there's a lot more you can get into here But I'm gonna try and keep this part sort of short because I didn't really get too deep into this piece when I was exploring all this but Any block Whether it be one that you create for og purposes, which is more likely than what I'm about to show you but you could Now it has this additional option, so like just do something down like page title, but I Have this context that is by group types So just like you have for node types you could say that this is You know only to show up on on band entity group entity pages and then views I had a little bit of time to try and build something but There's a couple of things that are a little tricky how to do this quickly Screenshots so you see I was trying to build a view that would show a Link back to The group itself on the album for instance, right and you would think that would be fairly straightforward and it is but I Couldn't figure out how to do it with this group ID from URL piece The only thing that and I in fact I looked around and other people were saying the same thing that they end up having to use this raw Value from URL piece to get the relationships, right? And that once a piece of content is part of a group it lives here So it's gonna be group you know in our case group two because it was no group one because it was the first group We created and then that whatever the ID of the music or whichever album was right So once it's tied to that so you would have to use like raw value from URL to and for if you wanted to Somehow get you know get at the relationship data and then finally You know there's obviously tons of stuff like we could have done here We could get into flags and flagging content favorite shows favorite albums We could do comments and voting and if might be a fun to site to build out actually But for now, that's just a demo And I did there's some to do's in here Which are the things that I mentioned earlier that I would personally like to get in into one of these sprints and maybe hammer this stuff out Some of the stuff I pointed out to you with the defaults in the checkboxes. I think that's confusing personally The thing with the views contextual filters I ran into a bug a couple times And I meant to create a new issue for it. I haven't gotten around to it but Where when I was creating a new group everything seemed fine and I came back You know hours later, then I would try to create a new group and it would have the exact same The data from the group I had already created which was submitted successfully and I don't know what was up with that That's just I was thinking I'd be nice to have you know how you have No add links up here. You don't have that by default So it'd be cool to have group add a group and then the types of groups. That's just a little little things And then Got a bunch of links, of course, you'll be able to get this slide deck off the site Also off of mobile.com. We will have this posted on our blog And there you go contribute come tomorrow to Contribution sprints. I'm hoping to be like I said dealing with some of these things in there tomorrow And yeah, that's it Okay, are there any questions So you mentioned that any additional roles could be added is member required to always exist And then other roles will be a addition to that or can you delete member exactly big member and Outsider and anonymous are all required You can you can tell it not to create that admin role when you first set it up like a surgery But that's the only one you can get rid of Yeah I was wondering about content that's owned by multiple groups how permissions kind of play on there to be played with that at all That is a good question. I haven't gotten to play with that at all. So it's a good question The question was how does the group play with multiple if the node is owned by multiple groups Question, how would you use or could you? Does groups allow for something similar to og menus where the group content can automatically be linked Directly to groups when you create a content and because I noticed that you had a menu settings But I didn't know or see a Way to link those cut those content types to that group Right. I honestly don't know. Oh, yeah, good. Great. Go Okay, is there a group in DA? Very cool. No, thank you. I have you tried or do you have any advice on migrating from? og in seven to this and eight Not the foggiest Personally wouldn't attempt it, but I'm not that I'm not that sharp So maybe it would be easy for some some other developers, but it sounds like a scary thing to work with Thanks, I'm sure it's doable. You know, it's just a matter of how much effort Thank you