Closed (fixed)
Project:
Group
Version:
8.x-1.0-rc2
Component:
Group (group)
Priority:
Normal
Category:
Support request
Assigned:
Unassigned
Issue tags:
Reporter:
Created:
26 Jul 2016 at 07:25 UTC
Updated:
4 Jun 2019 at 13:56 UTC
Jump to comment: Most recent, Most recent file
Comments
Comment #2
kristiaanvandeneyndeI just added a new function for this:
Group::addContent(ContentEntityInterface $entity, $plugin_id, $values = [])Where
$plugin_idis more than likely 'group_node:YOUR_NODE_TYPE_HERE' and$valuescan be empty unless you want to populate fields on the node-to-group relation entity (GroupContent entity).Comment #3
kristiaanvandeneyndeP.S.: This will be in 8.x-1.0-beta1, you can try it out using the dev release.
Comment #5
Anonymous (not verified) commentedI'm trying to add an already existing node to a group and i'm getting sql error with using this addContent() method.
The code i'm using is quite simple so there might be something in that:
Maybe someone could help? I've tried all kinds of stuff but nothing works.
Comment #6
nit3ch commentedI am having the same problem when i am trying to use addContent() method in hook_ENTITY_TYPE_insert, Otherwise it is working fine.
Comment #7
docans commentedThe Solution in #5 only works if you have one 1 node you want to add to just the "article content type".
how will you modify this to work for multiple content type. for example how will you modify this code to work for both "article" and "basic_page" node content types
thanks
Comment #8
taylormade415 commentedmy plugin is accessible via /admin/group/content/manage/groups-group_node-playlists and fully configured.
yet when attempting any of these
i get
breakpoints lead to
$plugin = $group->getGroupType()->getContentPlugin($plugin_id);in modules/group/src/Entity/Storage/GroupContentStorage.php::createForEntityInGroupComment #9
taylormade415 commentedmy issue was the separator should be a colon. only this format worked:
$type = 'group_node:' . $node->getType();Comment #10
afschTo check if the content was already added to a group you can try:
Comment #11
chems commentedHello,
I create a custom entity content without bundle entity type id is 'project' , with project i create a plugin group with id 'group_project'.
When i try to addContent to group using
addContent(ContentEntityInterface $entity, $plugin_id, $values = [])addContent($entity, 'group_project')the error was plugin_id not found,i test with
addContent($entity, 'group_project:project')the error was entity not support bundleThe Derivate definition :
what should i do ?? thx for help !
Comment #12
chems commentedComment #13
dangur commented@chems you need a content enabler plugin for your entity type à la https://drupal.stackexchange.com/questions/259674/how-to-add-custom-enti...