social_group.api.php in Open Social 8.4
Same filename and directory in other branches
- 8.9 modules/social_features/social_group/social_group.api.php
- 8 modules/social_features/social_group/social_group.api.php
- 8.2 modules/social_features/social_group/social_group.api.php
- 8.3 modules/social_features/social_group/social_group.api.php
- 8.5 modules/social_features/social_group/social_group.api.php
- 8.6 modules/social_features/social_group/social_group.api.php
- 8.7 modules/social_features/social_group/social_group.api.php
- 8.8 modules/social_features/social_group/social_group.api.php
- 10.3.x modules/social_features/social_group/social_group.api.php
- 10.0.x modules/social_features/social_group/social_group.api.php
- 10.1.x modules/social_features/social_group/social_group.api.php
- 10.2.x modules/social_features/social_group/social_group.api.php
Hooks provided by the Social Group module.
File
modules/social_features/social_group/social_group.api.phpView source
<?php
/**
* @file
* Hooks provided by the Social Group module.
*/
/**
* @addtogroup hooks
* @{
*/
/**
* Provide a method to alter array of group types used in open social.
*
* @param array $social_group_types
* List of group types used in open social.
*
* @ingroup social_group_api
*/
function hook_social_group_types_alter(array &$social_group_types) {
$social_group_types[] = 'challenge';
}
/**
* Provide a method to alter the default visibility used for a group type.
*
* @param string $visibility
* The visibility option that is default.
* @param string $group_type_id
* The Group type we alter the visibility setting for.
*
* @ingroup social_group_api
*/
function hook_social_group_default_visibility_alter(&$visibility, $group_type_id) {
switch ($group_type_id) {
case 'custom_public_group':
$visibility = 'public';
break;
case 'custom_open_group':
$visibility = 'community';
break;
case 'custom_closed_group':
$visibility = 'group';
break;
}
}
/**
* Provide a method to alter default group overview route.
*
* @param array $route
* An array with route name and parameters.
* @param GroupInterface $group
* Current group entity.
*
* @ingroup social_group_api
*/
function hook_social_group_overview_route_alter(array &$route, GroupInterface $group) {
if ($group
->bundle() == 'challenge') {
$route = [
'name' => 'view.challenges_user.page',
'parameters' => [
'user' => \Drupal::currentUser()
->id(),
],
];
}
}
/**
* Provide a method to return node which was moved to another group.
*
* @param \Drupal\node\NodeInterface $node
* The event or topic node.
*
* @ingroup social_group_api
*/
function hook_social_group_move(\Drupal\node\NodeInterface $node) {
drupal_set_message(t('@title is moved.', [
'@title' => $node
->getTitle(),
]));
}
/**
* @} End of "addtogroup hooks".
*/
Functions
Name | Description |
---|---|
hook_social_group_default_visibility_alter | Provide a method to alter the default visibility used for a group type. |
hook_social_group_move | Provide a method to return node which was moved to another group. |
hook_social_group_overview_route_alter | Provide a method to alter default group overview route. |
hook_social_group_types_alter | Provide a method to alter array of group types used in open social. |