Loading config/optional/pathauto.pattern.group_content.yml +1 −1 Changes for config/optional/pathauto.pattern.group_content.yml: 1 added line, 1 removed line. Original line number Diff line number Diff line Loading @@ -4,7 +4,7 @@ dependencies: module: - group id: group_content label: 'Group content' label: 'Group relationship' type: 'canonical_entities:group_content' pattern: 'group/[group_content:group:id]/[group_content:pretty-path-key]/[group_content:id]' selection_criteria: { } Loading config/schema/group.schema.yml +3 −3 Changes for config/schema/group.schema.yml: 3 added lines, 3 removed lines. Original line number Diff line number Diff line Loading @@ -84,7 +84,7 @@ group.role.*: group_content_type: type: 'config_entity' label: 'Group content type' label: 'Group relationship type' mapping: id: type: 'string' Loading @@ -100,7 +100,7 @@ group_content_type: label: 'Group type ID' content_plugin: type: 'string' label: 'Group content plugin ID' label: 'Group relation plugin ID' plugin_config: type: 'sequence' label: 'Plugin configuration' Loading @@ -111,7 +111,7 @@ group_content_type: # Follows the pattern group.content_type.GROUP_TYPE_ID-PLUGIN_ID-DERIVATIVE_ID. group.content_type.*: type: 'group_content_type' label: 'Group content type' label: 'Group relationship type' entity_reference_selection.group_type:group_role: type: 'entity_reference_selection' Loading config/schema/group.views.schema.yml +5 −5 Changes for config/schema/group.views.schema.yml: 5 added lines, 5 removed lines. Original line number Diff line number Diff line Loading @@ -28,19 +28,19 @@ views_relationship_with_group_plugin_filter: mapping: group_content_plugins: type: 'sequence' label: 'Group content plugins' label: 'Group relation plugins' sequence: type: 'string' label: 'Group content plugin ID' label: 'Group relation plugin ID' views.relationship.group_content_to_entity: type: 'views_relationship_with_group_plugin_filter' label: 'Group content to entity reference' label: 'Group relationship to entity reference' views.relationship.group_content_to_entity_reverse: type: 'views_relationship_with_group_plugin_filter' label: 'Reverse group content to entity reference' label: 'Reverse group relationship to entity reference' views.relationship.group_to_group_content: type: 'views_relationship_with_group_plugin_filter' label: 'Group to group content' label: 'Group to group relationship' group.install +16 −16 Changes for group.install: 16 added lines, 16 removed lines. Original line number Diff line number Diff line Loading @@ -20,7 +20,7 @@ function group_update_last_removed() { } /** * Add plugin_id and group_type fields and update indexes for group content. * Add plugin_id and group_type fields and update indexes for group_content. */ function group_update_9201() { $definition_update_manager = \Drupal::entityDefinitionUpdateManager(); Loading Loading @@ -55,33 +55,33 @@ function group_update_9201() { // Update the fields and regenerate indexes. $definition_update_manager->updateFieldableEntityType($entity_type, $field_storage_definitions); // Map group content types to plugin IDs and group types. // Map relationship types to plugin IDs and group types. $config_factory = \Drupal::configFactory(); $map = ['group_type' => [], 'plugin_id' => []]; foreach ($config_factory->listAll('group.content_type.') as $config_name) { $group_content_type = $config_factory->get($config_name); $relationship_type = $config_factory->get($config_name); $id = $group_content_type->get('id'); $map['group_type'][$group_content_type->get('group_type')][] = $id; $map['plugin_id'][$group_content_type->get('content_plugin')][] = $id; $id = $relationship_type->get('id'); $map['group_type'][$relationship_type->get('group_type')][] = $id; $map['plugin_id'][$relationship_type->get('content_plugin')][] = $id; } // Populate the actual values based on the group content types. // Populate the actual values based on the relationship types. $data_table = $entity_type->getDataTable(); $database = \Drupal::database(); foreach ($map['group_type'] as $group_type_id => $group_content_type_ids) { foreach ($map['group_type'] as $group_type_id => $relationship_type_ids) { $database->update($data_table) ->fields(['group_type' => $group_type_id]) ->condition('type', $group_content_type_ids, 'IN') ->condition('type', $relationship_type_ids, 'IN') ->execute(); } foreach ($map['plugin_id'] as $plugin_id => $group_content_type_ids) { foreach ($map['plugin_id'] as $plugin_id => $relationship_type_ids) { $database->update($data_table) ->fields(['plugin_id' => $plugin_id]) ->condition('type', $group_content_type_ids, 'IN') ->condition('type', $relationship_type_ids, 'IN') ->execute(); } } Loading Loading @@ -237,16 +237,16 @@ function group_update_9206() { } /** * Remove label and description from group content types. * Remove label and description from relationship types. */ function group_update_9207() { $config_factory = \Drupal::configFactory(); foreach ($config_factory->listAll('group.content_type.') as $config_name) { $group_content_type = $config_factory->getEditable($config_name); $group_content_type->clear('label'); $group_content_type->clear('description'); $group_content_type->save(TRUE); $relationship_type = $config_factory->getEditable($config_name); $relationship_type->clear('label'); $relationship_type->clear('description'); $relationship_type->save(TRUE); } } Loading group.module +8 −8 Changes for group.module: 8 added lines, 8 removed lines. Original line number Diff line number Diff line Loading @@ -275,7 +275,7 @@ function group_query_entity_query_alter(SelectInterface $query) { $entity_type = $entity_type_manager->getDefinition($entity_type_id); // Add specific access checks based on the entity type. Please note that we // first check for the group and group content entity types because we have // first check for the group and relationship entity types because we have // full control over those and can therefore optimize the query more. If the // query is for a different entity type, we fall back to the default query // alter. Loading Loading @@ -360,7 +360,7 @@ function group_entity_access(EntityInterface $entity, $operation, AccountInterfa return AccessResult::neutral(); } // If any new group content entity is added using any of the retrieved // If any new relationship entity is added using any of the retrieved // plugins, it might change access. $plugin_cache_tags = []; foreach ($plugin_ids as $plugin_id) { Loading Loading @@ -431,7 +431,7 @@ function group_entity_field_access($operation, FieldDefinitionInterface $field_d return AccessResult::neutral(); } // We only care if it is attached to a group content entity. // We only care if it is attached to a relationship type entity. if ($items->getEntity()->getEntityTypeId() != 'group_content') { return AccessResult::neutral(); } Loading @@ -439,7 +439,7 @@ function group_entity_field_access($operation, FieldDefinitionInterface $field_d $group_content = $items->getEntity(); assert($group_content instanceof GroupContentInterface); // We only care if the group content entity is a group membership. // We only care if the relationship entity is a group membership. if ($group_content->getPluginId() != 'group_membership') { return AccessResult::neutral(); } Loading Loading @@ -643,7 +643,7 @@ function group_content_wizard_store($form, FormStateInterface $form_state) { } /** * Cancels the wizard for group content creation. * Cancels the wizard for relationship creation. * * @see group_form_alter() * @see \Drupal\group\Entity\Controller\GroupContentController::createForm() Loading Loading @@ -673,12 +673,12 @@ function group_content_entity_submit($form, FormStateInterface $form_state) { $group = $form_state->get('group'); assert($group instanceof GroupInterface); $group->addContent($entity, $form_state->get('group_relation')); $group->addRelationship($entity, $form_state->get('group_relation')); // This submit handler is only called when creating new content within a group // without using the 2-step wizard. We can therefore safely assume the user // wants to see the entity itself and not the relationship (group content). // This only applies if there was no destination GET parameter set in the URL. // wants to see the entity itself and not the relationship. This only applies // if there was no destination GET parameter set in the URL. if ($entity->access('view')) { $form_state->setRedirectUrl($entity->toUrl()); } Loading Loading
config/optional/pathauto.pattern.group_content.yml +1 −1 Changes for config/optional/pathauto.pattern.group_content.yml: 1 added line, 1 removed line. Original line number Diff line number Diff line Loading @@ -4,7 +4,7 @@ dependencies: module: - group id: group_content label: 'Group content' label: 'Group relationship' type: 'canonical_entities:group_content' pattern: 'group/[group_content:group:id]/[group_content:pretty-path-key]/[group_content:id]' selection_criteria: { } Loading
config/schema/group.schema.yml +3 −3 Changes for config/schema/group.schema.yml: 3 added lines, 3 removed lines. Original line number Diff line number Diff line Loading @@ -84,7 +84,7 @@ group.role.*: group_content_type: type: 'config_entity' label: 'Group content type' label: 'Group relationship type' mapping: id: type: 'string' Loading @@ -100,7 +100,7 @@ group_content_type: label: 'Group type ID' content_plugin: type: 'string' label: 'Group content plugin ID' label: 'Group relation plugin ID' plugin_config: type: 'sequence' label: 'Plugin configuration' Loading @@ -111,7 +111,7 @@ group_content_type: # Follows the pattern group.content_type.GROUP_TYPE_ID-PLUGIN_ID-DERIVATIVE_ID. group.content_type.*: type: 'group_content_type' label: 'Group content type' label: 'Group relationship type' entity_reference_selection.group_type:group_role: type: 'entity_reference_selection' Loading
config/schema/group.views.schema.yml +5 −5 Changes for config/schema/group.views.schema.yml: 5 added lines, 5 removed lines. Original line number Diff line number Diff line Loading @@ -28,19 +28,19 @@ views_relationship_with_group_plugin_filter: mapping: group_content_plugins: type: 'sequence' label: 'Group content plugins' label: 'Group relation plugins' sequence: type: 'string' label: 'Group content plugin ID' label: 'Group relation plugin ID' views.relationship.group_content_to_entity: type: 'views_relationship_with_group_plugin_filter' label: 'Group content to entity reference' label: 'Group relationship to entity reference' views.relationship.group_content_to_entity_reverse: type: 'views_relationship_with_group_plugin_filter' label: 'Reverse group content to entity reference' label: 'Reverse group relationship to entity reference' views.relationship.group_to_group_content: type: 'views_relationship_with_group_plugin_filter' label: 'Group to group content' label: 'Group to group relationship'
group.install +16 −16 Changes for group.install: 16 added lines, 16 removed lines. Original line number Diff line number Diff line Loading @@ -20,7 +20,7 @@ function group_update_last_removed() { } /** * Add plugin_id and group_type fields and update indexes for group content. * Add plugin_id and group_type fields and update indexes for group_content. */ function group_update_9201() { $definition_update_manager = \Drupal::entityDefinitionUpdateManager(); Loading Loading @@ -55,33 +55,33 @@ function group_update_9201() { // Update the fields and regenerate indexes. $definition_update_manager->updateFieldableEntityType($entity_type, $field_storage_definitions); // Map group content types to plugin IDs and group types. // Map relationship types to plugin IDs and group types. $config_factory = \Drupal::configFactory(); $map = ['group_type' => [], 'plugin_id' => []]; foreach ($config_factory->listAll('group.content_type.') as $config_name) { $group_content_type = $config_factory->get($config_name); $relationship_type = $config_factory->get($config_name); $id = $group_content_type->get('id'); $map['group_type'][$group_content_type->get('group_type')][] = $id; $map['plugin_id'][$group_content_type->get('content_plugin')][] = $id; $id = $relationship_type->get('id'); $map['group_type'][$relationship_type->get('group_type')][] = $id; $map['plugin_id'][$relationship_type->get('content_plugin')][] = $id; } // Populate the actual values based on the group content types. // Populate the actual values based on the relationship types. $data_table = $entity_type->getDataTable(); $database = \Drupal::database(); foreach ($map['group_type'] as $group_type_id => $group_content_type_ids) { foreach ($map['group_type'] as $group_type_id => $relationship_type_ids) { $database->update($data_table) ->fields(['group_type' => $group_type_id]) ->condition('type', $group_content_type_ids, 'IN') ->condition('type', $relationship_type_ids, 'IN') ->execute(); } foreach ($map['plugin_id'] as $plugin_id => $group_content_type_ids) { foreach ($map['plugin_id'] as $plugin_id => $relationship_type_ids) { $database->update($data_table) ->fields(['plugin_id' => $plugin_id]) ->condition('type', $group_content_type_ids, 'IN') ->condition('type', $relationship_type_ids, 'IN') ->execute(); } } Loading Loading @@ -237,16 +237,16 @@ function group_update_9206() { } /** * Remove label and description from group content types. * Remove label and description from relationship types. */ function group_update_9207() { $config_factory = \Drupal::configFactory(); foreach ($config_factory->listAll('group.content_type.') as $config_name) { $group_content_type = $config_factory->getEditable($config_name); $group_content_type->clear('label'); $group_content_type->clear('description'); $group_content_type->save(TRUE); $relationship_type = $config_factory->getEditable($config_name); $relationship_type->clear('label'); $relationship_type->clear('description'); $relationship_type->save(TRUE); } } Loading
group.module +8 −8 Changes for group.module: 8 added lines, 8 removed lines. Original line number Diff line number Diff line Loading @@ -275,7 +275,7 @@ function group_query_entity_query_alter(SelectInterface $query) { $entity_type = $entity_type_manager->getDefinition($entity_type_id); // Add specific access checks based on the entity type. Please note that we // first check for the group and group content entity types because we have // first check for the group and relationship entity types because we have // full control over those and can therefore optimize the query more. If the // query is for a different entity type, we fall back to the default query // alter. Loading Loading @@ -360,7 +360,7 @@ function group_entity_access(EntityInterface $entity, $operation, AccountInterfa return AccessResult::neutral(); } // If any new group content entity is added using any of the retrieved // If any new relationship entity is added using any of the retrieved // plugins, it might change access. $plugin_cache_tags = []; foreach ($plugin_ids as $plugin_id) { Loading Loading @@ -431,7 +431,7 @@ function group_entity_field_access($operation, FieldDefinitionInterface $field_d return AccessResult::neutral(); } // We only care if it is attached to a group content entity. // We only care if it is attached to a relationship type entity. if ($items->getEntity()->getEntityTypeId() != 'group_content') { return AccessResult::neutral(); } Loading @@ -439,7 +439,7 @@ function group_entity_field_access($operation, FieldDefinitionInterface $field_d $group_content = $items->getEntity(); assert($group_content instanceof GroupContentInterface); // We only care if the group content entity is a group membership. // We only care if the relationship entity is a group membership. if ($group_content->getPluginId() != 'group_membership') { return AccessResult::neutral(); } Loading Loading @@ -643,7 +643,7 @@ function group_content_wizard_store($form, FormStateInterface $form_state) { } /** * Cancels the wizard for group content creation. * Cancels the wizard for relationship creation. * * @see group_form_alter() * @see \Drupal\group\Entity\Controller\GroupContentController::createForm() Loading Loading @@ -673,12 +673,12 @@ function group_content_entity_submit($form, FormStateInterface $form_state) { $group = $form_state->get('group'); assert($group instanceof GroupInterface); $group->addContent($entity, $form_state->get('group_relation')); $group->addRelationship($entity, $form_state->get('group_relation')); // This submit handler is only called when creating new content within a group // without using the 2-step wizard. We can therefore safely assume the user // wants to see the entity itself and not the relationship (group content). // This only applies if there was no destination GET parameter set in the URL. // wants to see the entity itself and not the relationship. This only applies // if there was no destination GET parameter set in the URL. if ($entity->access('view')) { $form_state->setRedirectUrl($entity->toUrl()); } Loading