Add ambassadors field to groups
Ambassadors assigned to a group now enlisted on the group page. Community managers and site administrator allowed to assign / revoke ambassadors of a group. Change-Id: Ib92e97669780f48edd56bd1e6df659d1d4e1d5c4
This commit is contained in:
parent
1098802c51
commit
8350ffa897
@ -10,6 +10,48 @@
|
|||||||
function groups_groups_field_default_field_bases() {
|
function groups_groups_field_default_field_bases() {
|
||||||
$field_bases = array();
|
$field_bases = array();
|
||||||
|
|
||||||
|
// Exported field_base: 'field_ambassadors'
|
||||||
|
$field_bases['field_ambassadors'] = array(
|
||||||
|
'active' => 1,
|
||||||
|
'cardinality' => -1,
|
||||||
|
'deleted' => 0,
|
||||||
|
'entity_types' => array(),
|
||||||
|
'field_name' => 'field_ambassadors',
|
||||||
|
'foreign keys' => array(
|
||||||
|
'users' => array(
|
||||||
|
'columns' => array(
|
||||||
|
'target_id' => 'uid',
|
||||||
|
),
|
||||||
|
'table' => 'users',
|
||||||
|
),
|
||||||
|
),
|
||||||
|
'indexes' => array(
|
||||||
|
'target_id' => array(
|
||||||
|
0 => 'target_id',
|
||||||
|
),
|
||||||
|
),
|
||||||
|
'locked' => 0,
|
||||||
|
'module' => 'entityreference',
|
||||||
|
'settings' => array(
|
||||||
|
'handler' => 'views',
|
||||||
|
'handler_settings' => array(
|
||||||
|
'behaviors' => array(
|
||||||
|
'views-select-list' => array(
|
||||||
|
'status' => 0,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
'view' => array(
|
||||||
|
'args' => array(),
|
||||||
|
'display_name' => 'entityreference_1',
|
||||||
|
'view_name' => 'groups_ambassadors',
|
||||||
|
),
|
||||||
|
),
|
||||||
|
'target_type' => 'user',
|
||||||
|
),
|
||||||
|
'translatable' => 0,
|
||||||
|
'type' => 'entityreference',
|
||||||
|
);
|
||||||
|
|
||||||
// Exported field_base: 'field_geofield'
|
// Exported field_base: 'field_geofield'
|
||||||
$field_bases['field_geofield'] = array(
|
$field_bases['field_geofield'] = array(
|
||||||
'active' => 1,
|
'active' => 1,
|
||||||
|
@ -10,6 +10,51 @@
|
|||||||
function groups_groups_field_default_field_instances() {
|
function groups_groups_field_default_field_instances() {
|
||||||
$field_instances = array();
|
$field_instances = array();
|
||||||
|
|
||||||
|
// Exported field_instance: 'node-group-field_ambassadors'
|
||||||
|
$field_instances['node-group-field_ambassadors'] = array(
|
||||||
|
'bundle' => 'group',
|
||||||
|
'default_value' => NULL,
|
||||||
|
'default_value_function' => '',
|
||||||
|
'deleted' => 0,
|
||||||
|
'description' => '',
|
||||||
|
'display' => array(
|
||||||
|
'default' => array(
|
||||||
|
'label' => 'above',
|
||||||
|
'module' => 'entityreference',
|
||||||
|
'settings' => array(
|
||||||
|
'link' => FALSE,
|
||||||
|
),
|
||||||
|
'type' => 'entityreference_label',
|
||||||
|
'weight' => 20,
|
||||||
|
),
|
||||||
|
'teaser' => array(
|
||||||
|
'label' => 'above',
|
||||||
|
'settings' => array(),
|
||||||
|
'type' => 'hidden',
|
||||||
|
'weight' => 0,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
'entity_type' => 'node',
|
||||||
|
'field_name' => 'field_ambassadors',
|
||||||
|
'label' => 'Ambassadors',
|
||||||
|
'required' => 0,
|
||||||
|
'settings' => array(
|
||||||
|
'behaviors' => array(
|
||||||
|
'prepopulate' => array(
|
||||||
|
'status' => 0,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
'user_register_form' => FALSE,
|
||||||
|
),
|
||||||
|
'widget' => array(
|
||||||
|
'active' => 1,
|
||||||
|
'module' => 'options',
|
||||||
|
'settings' => array(),
|
||||||
|
'type' => 'options_buttons',
|
||||||
|
'weight' => 50,
|
||||||
|
),
|
||||||
|
);
|
||||||
|
|
||||||
// Exported field_instance: 'node-group-field_geofield'
|
// Exported field_instance: 'node-group-field_geofield'
|
||||||
$field_instances['node-group-field_geofield'] = array(
|
$field_instances['node-group-field_geofield'] = array(
|
||||||
'bundle' => 'group',
|
'bundle' => 'group',
|
||||||
@ -221,6 +266,7 @@ function groups_groups_field_default_field_instances() {
|
|||||||
|
|
||||||
// Translatables
|
// Translatables
|
||||||
// Included for use with string extractors like potx.
|
// Included for use with string extractors like potx.
|
||||||
|
t('Ambassadors');
|
||||||
t('Group location');
|
t('Group location');
|
||||||
t('Group status');
|
t('Group status');
|
||||||
t('Resource links');
|
t('Resource links');
|
||||||
|
12
modules/groups/groups_groups/groups_groups.features.inc
Normal file
12
modules/groups/groups_groups/groups_groups.features.inc
Normal file
@ -0,0 +1,12 @@
|
|||||||
|
<?php
|
||||||
|
/**
|
||||||
|
* @file
|
||||||
|
* groups_groups.features.inc
|
||||||
|
*/
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Implements hook_views_api().
|
||||||
|
*/
|
||||||
|
function groups_groups_views_api($module = NULL, $api = NULL) {
|
||||||
|
return array("api" => "3.0");
|
||||||
|
}
|
@ -5,6 +5,7 @@ package = groups
|
|||||||
version = 7.x-1.0
|
version = 7.x-1.0
|
||||||
project = groups_groups
|
project = groups_groups
|
||||||
dependencies[] = commons_groups
|
dependencies[] = commons_groups
|
||||||
|
dependencies[] = entityreference
|
||||||
dependencies[] = features
|
dependencies[] = features
|
||||||
dependencies[] = field_group_location
|
dependencies[] = field_group_location
|
||||||
dependencies[] = field_property_list
|
dependencies[] = field_property_list
|
||||||
@ -14,12 +15,16 @@ dependencies[] = groups_common
|
|||||||
dependencies[] = list
|
dependencies[] = list
|
||||||
dependencies[] = number
|
dependencies[] = number
|
||||||
dependencies[] = options
|
dependencies[] = options
|
||||||
|
dependencies[] = views
|
||||||
|
features[ctools][] = views:views_default:3.0
|
||||||
features[features_api][] = api:2
|
features[features_api][] = api:2
|
||||||
|
features[field_base][] = field_ambassadors
|
||||||
features[field_base][] = field_geofield
|
features[field_base][] = field_geofield
|
||||||
features[field_base][] = field_group_location
|
features[field_base][] = field_group_location
|
||||||
features[field_base][] = field_group_status
|
features[field_base][] = field_group_status
|
||||||
features[field_base][] = field_meetup_members
|
features[field_base][] = field_meetup_members
|
||||||
features[field_base][] = field_resource_links
|
features[field_base][] = field_resource_links
|
||||||
|
features[field_instance][] = node-group-field_ambassadors
|
||||||
features[field_instance][] = node-group-field_geofield
|
features[field_instance][] = node-group-field_geofield
|
||||||
features[field_instance][] = node-group-field_group_location
|
features[field_instance][] = node-group-field_group_location
|
||||||
features[field_instance][] = node-group-field_group_status
|
features[field_instance][] = node-group-field_group_status
|
||||||
@ -27,4 +32,6 @@ features[field_instance][] = node-group-field_meetup_members
|
|||||||
features[field_instance][] = node-group-field_resource_links
|
features[field_instance][] = node-group-field_resource_links
|
||||||
features[user_role][] = ambassador
|
features[user_role][] = ambassador
|
||||||
features[user_role][] = community_manager
|
features[user_role][] = community_manager
|
||||||
mtime = 1421829172
|
features[views_view][] = groups_ambassadors
|
||||||
|
features_exclude[dependencies][ctools] = ctools
|
||||||
|
mtime = 1423845401
|
||||||
|
@ -1,4 +1,10 @@
|
|||||||
<?php
|
<?php
|
||||||
|
/**
|
||||||
|
* @file
|
||||||
|
* Code for the groups Groups feature.
|
||||||
|
*/
|
||||||
|
|
||||||
|
include_once 'groups_groups.features.inc';
|
||||||
/**
|
/**
|
||||||
* @file
|
* @file
|
||||||
* Groups groups content type related extensions.
|
* Groups groups content type related extensions.
|
||||||
@ -167,6 +173,7 @@ function groups_groups_form_alter(&$form, &$form_state, $form_id) {
|
|||||||
if ($form_id == 'group_node_form') {
|
if ($form_id == 'group_node_form') {
|
||||||
$node = $form_state['node'];
|
$node = $form_state['node'];
|
||||||
$is_administrator = in_array('administrator', array_values($user->roles));
|
$is_administrator = in_array('administrator', array_values($user->roles));
|
||||||
|
$is_community_mgr = in_array('community_manager', array_values($user->roles));
|
||||||
// hide group status field
|
// hide group status field
|
||||||
$form['field_group_status']['#access'] = $is_administrator;
|
$form['field_group_status']['#access'] = $is_administrator;
|
||||||
// hide location geofield
|
// hide location geofield
|
||||||
@ -177,6 +184,8 @@ function groups_groups_form_alter(&$form, &$form_state, $form_id) {
|
|||||||
$form['field_meetup_members']['#access'] = $is_administrator;
|
$form['field_meetup_members']['#access'] = $is_administrator;
|
||||||
// hide group logo
|
// hide group logo
|
||||||
$form['field_group_logo']['#access'] = false;
|
$form['field_group_logo']['#access'] = false;
|
||||||
|
// allow ambassador assignment for admin or community managers
|
||||||
|
$form['field_ambassadors']['#access'] = $is_community_mgr || $is_administrator;
|
||||||
|
|
||||||
$form['field_group_location']['und'][0]['location']['#title'] = 'City (optional)';
|
$form['field_group_location']['und'][0]['location']['#title'] = 'City (optional)';
|
||||||
// reorder resource links, group location
|
// reorder resource links, group location
|
||||||
|
93
modules/groups/groups_groups/groups_groups.views_default.inc
Normal file
93
modules/groups/groups_groups/groups_groups.views_default.inc
Normal file
@ -0,0 +1,93 @@
|
|||||||
|
<?php
|
||||||
|
/**
|
||||||
|
* @file
|
||||||
|
* groups_groups.views_default.inc
|
||||||
|
*/
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Implements hook_views_default_views().
|
||||||
|
*/
|
||||||
|
function groups_groups_views_default_views() {
|
||||||
|
$export = array();
|
||||||
|
|
||||||
|
$view = new view();
|
||||||
|
$view->name = 'groups_ambassadors';
|
||||||
|
$view->description = '';
|
||||||
|
$view->tag = 'default';
|
||||||
|
$view->base_table = 'users';
|
||||||
|
$view->human_name = 'Groups Ambassadors';
|
||||||
|
$view->core = 7;
|
||||||
|
$view->api_version = '3.0';
|
||||||
|
$view->disabled = FALSE; /* Edit this to true to make a default view disabled initially */
|
||||||
|
|
||||||
|
/* Display: Master */
|
||||||
|
$handler = $view->new_display('default', 'Master', 'default');
|
||||||
|
$handler->display->display_options['use_more_always'] = FALSE;
|
||||||
|
$handler->display->display_options['access']['type'] = 'perm';
|
||||||
|
$handler->display->display_options['access']['perm'] = 'access user profiles';
|
||||||
|
$handler->display->display_options['cache']['type'] = 'none';
|
||||||
|
$handler->display->display_options['query']['type'] = 'views_query';
|
||||||
|
$handler->display->display_options['exposed_form']['type'] = 'basic';
|
||||||
|
$handler->display->display_options['pager']['type'] = 'full';
|
||||||
|
$handler->display->display_options['style_plugin'] = 'default';
|
||||||
|
$handler->display->display_options['row_plugin'] = 'fields';
|
||||||
|
/* Field: User: Name */
|
||||||
|
$handler->display->display_options['fields']['name']['id'] = 'name';
|
||||||
|
$handler->display->display_options['fields']['name']['table'] = 'users';
|
||||||
|
$handler->display->display_options['fields']['name']['field'] = 'name';
|
||||||
|
$handler->display->display_options['fields']['name']['label'] = '';
|
||||||
|
$handler->display->display_options['fields']['name']['alter']['word_boundary'] = FALSE;
|
||||||
|
$handler->display->display_options['fields']['name']['alter']['ellipsis'] = FALSE;
|
||||||
|
/* Sort criterion: User: Name */
|
||||||
|
$handler->display->display_options['sorts']['name']['id'] = 'name';
|
||||||
|
$handler->display->display_options['sorts']['name']['table'] = 'users';
|
||||||
|
$handler->display->display_options['sorts']['name']['field'] = 'name';
|
||||||
|
/* Filter criterion: User: Active */
|
||||||
|
$handler->display->display_options['filters']['status']['id'] = 'status';
|
||||||
|
$handler->display->display_options['filters']['status']['table'] = 'users';
|
||||||
|
$handler->display->display_options['filters']['status']['field'] = 'status';
|
||||||
|
$handler->display->display_options['filters']['status']['value'] = '1';
|
||||||
|
$handler->display->display_options['filters']['status']['group'] = 1;
|
||||||
|
$handler->display->display_options['filters']['status']['expose']['operator'] = FALSE;
|
||||||
|
/* Filter criterion: User: Roles */
|
||||||
|
$handler->display->display_options['filters']['rid']['id'] = 'rid';
|
||||||
|
$handler->display->display_options['filters']['rid']['table'] = 'users_roles';
|
||||||
|
$handler->display->display_options['filters']['rid']['field'] = 'rid';
|
||||||
|
$handler->display->display_options['filters']['rid']['value'] = array(
|
||||||
|
5 => '5',
|
||||||
|
);
|
||||||
|
|
||||||
|
/* Display: Entity Reference */
|
||||||
|
$handler = $view->new_display('entityreference', 'Entity Reference', 'entityreference_1');
|
||||||
|
$handler->display->display_options['defaults']['title'] = FALSE;
|
||||||
|
$handler->display->display_options['pager']['type'] = 'some';
|
||||||
|
$handler->display->display_options['defaults']['style_plugin'] = FALSE;
|
||||||
|
$handler->display->display_options['style_plugin'] = 'entityreference_style';
|
||||||
|
$handler->display->display_options['style_options']['search_fields'] = array(
|
||||||
|
'name' => 'name',
|
||||||
|
);
|
||||||
|
$handler->display->display_options['defaults']['style_options'] = FALSE;
|
||||||
|
$handler->display->display_options['defaults']['row_plugin'] = FALSE;
|
||||||
|
$handler->display->display_options['row_plugin'] = 'entityreference_fields';
|
||||||
|
$handler->display->display_options['defaults']['row_options'] = FALSE;
|
||||||
|
$translatables['groups_ambassadors'] = array(
|
||||||
|
t('Master'),
|
||||||
|
t('more'),
|
||||||
|
t('Apply'),
|
||||||
|
t('Reset'),
|
||||||
|
t('Sort by'),
|
||||||
|
t('Asc'),
|
||||||
|
t('Desc'),
|
||||||
|
t('Items per page'),
|
||||||
|
t('- All -'),
|
||||||
|
t('Offset'),
|
||||||
|
t('« first'),
|
||||||
|
t('‹ previous'),
|
||||||
|
t('next ›'),
|
||||||
|
t('last »'),
|
||||||
|
t('Entity Reference'),
|
||||||
|
);
|
||||||
|
$export['groups_ambassadors'] = $view;
|
||||||
|
|
||||||
|
return $export;
|
||||||
|
}
|
@ -16,4 +16,4 @@ features[ctools][] = strongarm:strongarm:1
|
|||||||
features[features_api][] = api:2
|
features[features_api][] = api:2
|
||||||
features[panelizer_defaults][] = node:group:default
|
features[panelizer_defaults][] = node:group:default
|
||||||
features[variable][] = panelizer_defaults_node_group
|
features[variable][] = panelizer_defaults_node_group
|
||||||
mtime = 1420554875
|
mtime = 1423578792
|
||||||
|
@ -210,6 +210,39 @@ function groups_pages_panelizer_defaults() {
|
|||||||
$display->content['new-89D9A851-8F3A-45BA-AF74-7E55EBF9BB3C'] = $pane;
|
$display->content['new-89D9A851-8F3A-45BA-AF74-7E55EBF9BB3C'] = $pane;
|
||||||
$display->panels['two_66_33_second'][1] = 'new-89D9A851-8F3A-45BA-AF74-7E55EBF9BB3C';
|
$display->panels['two_66_33_second'][1] = 'new-89D9A851-8F3A-45BA-AF74-7E55EBF9BB3C';
|
||||||
$pane = new stdClass();
|
$pane = new stdClass();
|
||||||
|
$pane->pid = 'new-95912BBD-5323-4916-B618-6308E1262D31';
|
||||||
|
$pane->panel = 'two_66_33_second';
|
||||||
|
$pane->type = 'entity_field';
|
||||||
|
$pane->subtype = 'node:field_ambassadors';
|
||||||
|
$pane->shown = TRUE;
|
||||||
|
$pane->access = array();
|
||||||
|
$pane->configuration = array(
|
||||||
|
'label' => 'title',
|
||||||
|
'formatter' => 'og_list_default',
|
||||||
|
'delta_limit' => '0',
|
||||||
|
'delta_offset' => '0',
|
||||||
|
'delta_reversed' => 0,
|
||||||
|
'formatter_settings' => array(
|
||||||
|
'link' => 0,
|
||||||
|
'view_mode' => 'default',
|
||||||
|
'links' => 1,
|
||||||
|
),
|
||||||
|
'context' => 'panelizer',
|
||||||
|
'override_title' => 1,
|
||||||
|
'override_title_text' => 'Ambassadors of this group',
|
||||||
|
);
|
||||||
|
$pane->cache = array();
|
||||||
|
$pane->style = array(
|
||||||
|
'settings' => NULL,
|
||||||
|
);
|
||||||
|
$pane->css = array();
|
||||||
|
$pane->extras = array();
|
||||||
|
$pane->position = 2;
|
||||||
|
$pane->locks = array();
|
||||||
|
$pane->uuid = '95912BBD-5323-4916-B618-6308E1262D31';
|
||||||
|
$display->content['new-95912BBD-5323-4916-B618-6308E1262D31'] = $pane;
|
||||||
|
$display->panels['two_66_33_second'][2] = 'new-95912BBD-5323-4916-B618-6308E1262D31';
|
||||||
|
$pane = new stdClass();
|
||||||
$pane->pid = 'new-B17247AB-8C6E-4DB5-A8E0-78C8CF4462FA';
|
$pane->pid = 'new-B17247AB-8C6E-4DB5-A8E0-78C8CF4462FA';
|
||||||
$pane->panel = 'two_66_33_second';
|
$pane->panel = 'two_66_33_second';
|
||||||
$pane->type = 'views_panes';
|
$pane->type = 'views_panes';
|
||||||
@ -228,11 +261,11 @@ function groups_pages_panelizer_defaults() {
|
|||||||
);
|
);
|
||||||
$pane->css = array();
|
$pane->css = array();
|
||||||
$pane->extras = array();
|
$pane->extras = array();
|
||||||
$pane->position = 2;
|
$pane->position = 3;
|
||||||
$pane->locks = array();
|
$pane->locks = array();
|
||||||
$pane->uuid = 'B17247AB-8C6E-4DB5-A8E0-78C8CF4462FA';
|
$pane->uuid = 'B17247AB-8C6E-4DB5-A8E0-78C8CF4462FA';
|
||||||
$display->content['new-B17247AB-8C6E-4DB5-A8E0-78C8CF4462FA'] = $pane;
|
$display->content['new-B17247AB-8C6E-4DB5-A8E0-78C8CF4462FA'] = $pane;
|
||||||
$display->panels['two_66_33_second'][2] = 'new-B17247AB-8C6E-4DB5-A8E0-78C8CF4462FA';
|
$display->panels['two_66_33_second'][3] = 'new-B17247AB-8C6E-4DB5-A8E0-78C8CF4462FA';
|
||||||
$pane = new stdClass();
|
$pane = new stdClass();
|
||||||
$pane->pid = 'new-737D0A90-738F-4637-ABE7-39AF64CC3A1F';
|
$pane->pid = 'new-737D0A90-738F-4637-ABE7-39AF64CC3A1F';
|
||||||
$pane->panel = 'two_66_33_second';
|
$pane->panel = 'two_66_33_second';
|
||||||
@ -251,11 +284,11 @@ function groups_pages_panelizer_defaults() {
|
|||||||
);
|
);
|
||||||
$pane->css = array();
|
$pane->css = array();
|
||||||
$pane->extras = array();
|
$pane->extras = array();
|
||||||
$pane->position = 3;
|
$pane->position = 4;
|
||||||
$pane->locks = array();
|
$pane->locks = array();
|
||||||
$pane->uuid = '737D0A90-738F-4637-ABE7-39AF64CC3A1F';
|
$pane->uuid = '737D0A90-738F-4637-ABE7-39AF64CC3A1F';
|
||||||
$display->content['new-737D0A90-738F-4637-ABE7-39AF64CC3A1F'] = $pane;
|
$display->content['new-737D0A90-738F-4637-ABE7-39AF64CC3A1F'] = $pane;
|
||||||
$display->panels['two_66_33_second'][3] = 'new-737D0A90-738F-4637-ABE7-39AF64CC3A1F';
|
$display->panels['two_66_33_second'][4] = 'new-737D0A90-738F-4637-ABE7-39AF64CC3A1F';
|
||||||
$display->hide_title = PANELS_TITLE_FIXED;
|
$display->hide_title = PANELS_TITLE_FIXED;
|
||||||
$display->title_pane = '0';
|
$display->title_pane = '0';
|
||||||
$panelizer->display = $display;
|
$panelizer->display = $display;
|
||||||
|
Loading…
Reference in New Issue
Block a user