Skip to content
Snippets Groups Projects
Commit cbc238da authored by Chris Gross's avatar Chris Gross
Browse files

daily build

parent 3d7fd19c
No related branches found
No related tags found
No related merge requests found
Showing
with 388 additions and 127 deletions
WCM Base 7.x-1.x, pending
----------------------------
- OCIO User Config: Upgrade and patch Administer Users By Role module to fix
AJAX error when non-administrator adds photo while creating new user.
- OCIO User Contact: Added user contact page fields and pages.
WCM Base 7.x-1.x, 2015-08-24
----------------------------
- Drupal: Updated to 7.39 security release
......
......@@ -41,7 +41,7 @@ projects[ocio_workbench][options][working-copy] = TRUE
projects[ocio_wysiwyg][options][working-copy] = TRUE
projects[wcm_front_page][options][working-copy] = TRUE
projects[wcm_tile_panes][options][working-copy] = TRUE
projects[wcm_user_directory][options][working-copy] = TRUE
projects[wcm_user_contact][options][working-copy] = TRUE
projects[wcm_user_leadership][options][working-copy] = TRUE
projects[wcm_user_profile][options][working-copy] = TRUE
......
The following patches have been applied to this project:
- http://drupal.org/files/issues/administerusersbyrole-can_create_user_ajax_submit-2557473-13-D7.patch
This file was automatically generated by Drush Make (http://drupal.org/project/drush).
\ No newline at end of file
name = Administer Users by Role
description = "Allows users with 'administer users' permission and a role (specified in 'Permissions') to edit/delete other users with a specified role. Also provides control over user creation."
dependencies[] = chain_menu_access
core = 7.x
files[] = administerusersbyrole.test
files[] = views/administerusersbyrole_handler_field_user_link_edit.inc
files[] = views/administerusersbyrole_handler_field_user_link_cancel.inc
; Information added by Drupal.org packaging script on 2014-11-25
version = "7.x-2.0-beta1"
; Information added by Drupal.org packaging script on 2015-07-28
version = "7.x-2.0-rc1"
core = "7.x"
project = "administerusersbyrole"
datestamp = "1416955681"
datestamp = "1438069740"
......@@ -5,11 +5,22 @@
* Update migration code for administerusersbyrole.
*/
/**
* Implementation of hook_install().
*/
function administerusersbyrole_install() {
// We need to run after various other modules
// - After entity so that our hook_entity_info_alter is used.
// - After admin_views else due to a bug (https://www.drupal.org/node/2425121) it will break menu access settings.
// - After any other access modules so that our hook_menu_alter is used, as we will try harder than most modules
// to take account of other module's settings.
db_query("UPDATE {system} SET weight = 25 WHERE name = 'administerusersbyrole'");
}
/**
* Update permissions to match the new values used in version 2.
*/
function administerusersbyrole_update_7200()
{
function administerusersbyrole_update_7200() {
$roles = user_roles(TRUE);
foreach ($roles as $rid => $role) {
// Rename permissions from old value to new.
......@@ -42,6 +53,21 @@ function administerusersbyrole_update_7200()
return t('Role permissions updated for upgrade to Administer Users by Role version 2. Please check the new permissions are correct, in particular for "administer users".');
}
/**
* Update module weight and add dependency on chain_menu_access.
*/
function administerusersbyrole_update_7201() {
db_query("UPDATE {system} SET weight = 25 WHERE name = 'administerusersbyrole'");
// Enable new dependencies.
if (!module_enable(array('chain_menu_access'))) {
throw new DrupalUpdateException('To use latest version of "Administer Users by Role", please download the "Chain Menu Access API" module.');
}
// Rebuild menus using chain_menu_access.
menu_rebuild();
}
/**
* Generates a permission string for a given a role name.
*/
......
......@@ -35,54 +35,97 @@ function administerusersbyrole_permission() {
return $perms;
}
/**
* Implements hook_init().
*/
function administerusersbyrole_init() {
// The code in the user module to create a user relies on 'administer users' permission being set.
// We do alter this on the menu 'admin/people/create', but we also need to set this permission, when
// a register form is submitted for example by ajax (callback 'system/ajax' is used).
if (isset($_POST['form_build_id'])) {
$form_state = form_state_defaults();
$form = form_get_cache($_POST['form_build_id'], $form_state);
if (is_array($form) && $form['#form_id'] == 'user_register_form') {
_administerusersbyrole_can_create_users('elevate');
}
}
}
/**
* Implements hook_menu_alter().
*/
function administerusersbyrole_menu_alter(&$items) {
$items['user/%user']['access callback'] = '_administerusersbyrole_can_view_user';
$items['user/%user']['access arguments'] = array(1);
$items['user/%user/edit']['access callback'] = '_administerusersbyrole_can_edit_user';
$items['user/%user/edit']['access arguments'] = array(1);
$items['user/%user/cancel']['access callback'] = '_administerusersbyrole_can_cancel_user';
$items['user/%user/cancel']['access arguments'] = array(1);
// Dependency was added on chain_menu_access and, immediately after an update, the dependency may be missing.
// Make sure we don't render the whole website unusable in this case.
if (!module_exists('chain_menu_access')) {
return;
}
chain_menu_access_chain($items, 'user/%user', '_administerusersbyrole_check_access', array(1, 'edit'), TRUE);
chain_menu_access_chain($items, 'user/%user/edit', '_administerusersbyrole_check_access', array(1, 'edit'), TRUE);
chain_menu_access_chain($items, 'user/%user/cancel', '_administerusersbyrole_check_access', array(1, 'cancel'), TRUE);
$items['user/%user/cancel']['page callback'] = 'administerusersbyrole_cancel_confirm_wrapper';
$items['user/%user/cancel']['page arguments'] = array(1);
$items['admin/people']['access callback'] = '_administerusersbyrole_can_admin_people';
$items['admin/people/people']['access callback'] = '_administerusersbyrole_can_admin_people';
$items['admin/people/create']['access callback'] = '_administerusersbyrole_can_create_users';
chain_menu_access_chain($items, 'admin/people', 'user_access', array('access users overview'), TRUE);
// The code in the user module to create a user relies on 'administer users' permission being set, so pass an argument to elevate permissions.
$items['admin/people/create']['access arguments'] = array('elevate');
chain_menu_access_chain($items, 'admin/people/create', '_administerusersbyrole_can_create_users', array('elevate'), TRUE);
}
/**
* Determine access to the admin/people page.
* Implements hook_module_implements_alter().
*
* We need to be after the call from the entity module so our hook takes precedence.
*/
function _administerusersbyrole_can_admin_people() {
// Access by this module permission or the one from the user module.
return user_access('access users overview') || user_access('administer users');
function administerusersbyrole_module_implements_alter(&$implementations, $hook) {
if ($hook == 'entity_info_alter') {
// Move our hook implementation to the bottom.
$group = $implementations['administerusersbyrole'];
unset($implementations['administerusersbyrole']);
$implementations['administerusersbyrole'] = $group;
}
}
/**
* Determine access to view the specified user account.
* Implements hook_views_default_views_alter().
*/
function _administerusersbyrole_can_view_user($account) {
return user_view_access($account) || _administerusersbyrole_can_edit_user($account);
function administerusersbyrole_views_default_views_alter(&$views) {
if (isset($views['admin_views_user'])) {
// Add a tag to the admin_views module users view.
$handler =& $views['admin_views_user']->display['default']->handler;
$handler->display->display_options['query']['options']['query_tags'] = array('administerusersbyrole_edit_access');
}
}
/**
* Determine access to edit the specified user account.
* Implements hook_query_alter().
*/
function _administerusersbyrole_can_edit_user($account) {
return user_edit_access($account) || _administerusersbyrole_check_access($account, 'edit');
}
function administerusersbyrole_query_alter(QueryAlterableInterface $query) {
// The tag administerusersbyrole_edit_access is used to indicate that we should filter out users where there isn't edit access.
if ($query->hasTag('administerusersbyrole_edit_access') && !user_access('administer users')) {
// Exclude the root user.
$query->condition('users.uid', 1, '<>');
$roles = user_roles(TRUE);
foreach ($roles as $rid => $role) {
if (!user_access(_administerusersbyrole_build_perm_string($rid, 'edit'))) {
$exclude[$rid] = $rid;
}
}
if (isset($exclude[DRUPAL_AUTHENTICATED_RID])) {
// No permission unless there is a role.
$query->join('users_roles', 'users_roles_2', 'users_roles_2.uid=users.uid');
unset($exclude[DRUPAL_AUTHENTICATED_RID]);
}
/**
* Determine access to cancel the specified user account.
*/
function _administerusersbyrole_can_cancel_user($account) {
return user_cancel_access($account) || _administerusersbyrole_check_access($account, 'cancel');
// Do an "anti-join" on the excluded roles - add a left join and then check the results set is null.
// NB We don't have to check that $exclude might be empty, because it always contains the admin role.
$query->leftjoin('users_roles', 'users_roles', 'users_roles.uid=users.uid AND users_roles.rid IN (:exclude)', array(':exclude' => $exclude));
$query->isNull('users_roles.uid');
}
}
/**
* Determine access to create user accounts.
*/
......@@ -93,8 +136,7 @@ function _administerusersbyrole_can_create_users($extra = '') {
}
return TRUE;
}
return user_access('administer users');
return FALSE;
}
/**
......@@ -180,13 +222,64 @@ function administerusersbyrole_form_user_profile_form_alter(&$form, &$form_state
}
}
/**
* Implements hook_entity_info_alter().
*/
function administerusersbyrole_entity_info_alter(&$entity_info) {
$entity_info['user']['access callback'] = 'administerusersbyrole_metadata_user_access';
}
/**
* Implements hook_entity_property_info_alter().
*/
function administerusersbyrole_entity_property_info_alter(&$info) {
$properties = &$info['user']['properties'];
$properties['name']['access callback'] = 'administerusersbyrole_metadata_user_properties_access';
$properties['mail']['access callback'] = 'administerusersbyrole_metadata_user_properties_access';
$properties['status']['access callback'] = 'administerusersbyrole_metadata_user_properties_access';
$properties['theme']['access callback'] = 'administerusersbyrole_metadata_user_properties_access';
}
/**
* Access callback for the user entity.
*/
function administerusersbyrole_metadata_user_access($op, $account = NULL, $check_as = NULL) {
// Call the base function.
if (entity_metadata_user_access($op, $account, $check_as)) {
return TRUE;
}
$convert = array('delete' => 'cancel', 'update' => 'edit');
$op = $convert{$op};
if (isset($op)) {
// Call our own function.
$check_as = isset($check_as) ? $check_as : $GLOBALS['user'];
return _administerusersbyrole_check_access($account, $op, $check_as);
}
return FALSE;
}
/**
* Access callback for user entity properties.
*/
function administerusersbyrole_metadata_user_properties_access($op, $property, $account = NULL, $check_as = NULL) {
// Call the base function.
if (entity_metadata_user_properties_access($op, $property, $account, $check_as)) {
return TRUE;
}
$check_as = isset($check_as) ? $check_as : $GLOBALS['user'];
return _administerusersbyrole_check_access($account, 'edit', $check_as);
}
/**
* Check access to perform an operation on an account.
*
* This function checks the permissions of this module only. The calling code needs
* to check any Drupal core permissions that should also allow access.
*/
function _administerusersbyrole_check_access($account, $op) {
function _administerusersbyrole_check_access($account, $op, $check_as = NULL) {
// Never allow uid 0 (anonymous) or 1 (master admin).
if ($account->uid <= 1) {
return FALSE;
......@@ -203,7 +296,7 @@ function _administerusersbyrole_check_access($account, $op) {
if (($rid === DRUPAL_AUTHENTICATED_RID) && (count($account->roles) > 1)) {
continue;
}
if (!user_access(_administerusersbyrole_build_perm_string($rid, $op))) {
if (!user_access(_administerusersbyrole_build_perm_string($rid, $op), $check_as)) {
return FALSE;
}
}
......
......@@ -17,11 +17,10 @@ class administerusersbyrole_handler_field_user_link_cancel extends views_handler
function render_link($data, $values) {
$uid = $values->{$this->aliases['uid']};
// Build a pseudo account object to be able to check the access.
$account = new stdClass();
$account->uid = $uid;
// Pull the access information from the menu router item.
$item = menu_get_item("user/$uid/cancel");
if ($uid && _administerusersbyrole_can_cancel_user($account)) {
if ($item['access']) {
$this->options['alter']['make_link'] = TRUE;
$text = !empty($this->options['text']) ? $this->options['text'] : t('Cancel account');
......
......@@ -8,17 +8,16 @@
/**
* Field handler to present a link to user edit.
*
* Identical to the base class except change call to user_edit_access() for _administerusersbyrole_can_edit_user().
* Identical to the base class except change call to user_edit_access() for our updated access function.
*
* @ingroup views_field_handlers
*/
class administerusersbyrole_handler_field_user_link_edit extends views_handler_field_user_link_edit {
function render_link($data, $values) {
// Build a pseudo account object to be able to check the access.
$account = new stdClass();
$account->uid = $data;
// Pull the access information from the menu router item.
$item = menu_get_item("user/$data/edit");
if ($data && _administerusersbyrole_can_edit_user($account)) {
if ($item['access']) {
$this->options['alter']['make_link'] = TRUE;
$text = !empty($this->options['text']) ? $this->options['text'] : t('edit');
......
......@@ -150,6 +150,10 @@ function workbench_moderation_admin_states_form_submit($form, &$form_state) {
'weight' => $info['weight'],
);
workbench_moderation_state_save($state);
if (module_exists('i18n_string')) {
i18n_string_update(array('workbench_moderation', 'moderation_state', $info['name'], 'label'), $info['label']);
i18n_string_update(array('workbench_moderation', 'moderation_state', $info['name'], 'description'), $info['description']);
}
}
}
......
......@@ -186,14 +186,15 @@ function workbench_moderation_menu_alter(&$items) {
$items['node/%node/revisions']['page arguments'] = array(1);
// Override the node revision view callback.
$items['node/%node/revisions/%/view']['page callback'] = 'workbench_moderation_node_view_revision';
$items['node/%node/revisions/%/view']['file path'] = drupal_get_path('module', 'workbench_moderation');
$items['node/%node/revisions/%/view']['file'] = 'workbench_moderation.node.inc';
$items['node/%node/revisions/%/view']['page callback'] = 'workbench_moderation_node_view_revision';
$items['node/%node/revisions/%/view']['file path'] = drupal_get_path('module', 'workbench_moderation');
$items['node/%node/revisions/%/view']['file'] = 'workbench_moderation.node.inc';
// For revert and delete operations, use our own access check.
$items['node/%node/revisions/%/revert']['access callback'] = '_workbench_moderation_revision_access';
$items['node/%node/revisions/%/revert']['access arguments'] = array(1, 'update');
$items['node/%node/revisions/%/delete']['access callback'] = '_workbench_moderation_revision_access';
$items['node/%node/revisions/%/delete']['access arguments'] = array(1, 'delete');
// Provide a container administration menu item, if one doesn't already exist.
if (!isset($items['admin/config/workbench'])) {
......@@ -527,27 +528,8 @@ function _workbench_moderation_revision_access($node, $op) {
}
}
// Temporarily give the node an impossible revision.
// _node_revision_access() keeps access check results in a static variable
// indexed by revision only, not by op. Thus, subsequent checks on the same
// vid for different ops yield the same result, regardless of permissions.
// Setting a fake vid here allows us to store different static results per op.
$tmp = $node->vid;
switch ($op) {
case 'update':
$node->vid = -1;
break;
case 'delete':
$node->vid = -2;
break;
}
// Check access.
$access = _node_revision_access($node, $op);
// Restore the original revision id.
$node->vid = $tmp;
return $access;
return _node_revision_access($node, $op);
}
/**
......@@ -1354,13 +1336,49 @@ function workbench_moderation_state_labels() {
if (!isset($labels)) {
$labels = array();
foreach (workbench_moderation_states() as $machine_name => $state) {
$labels[$machine_name] = $state->label;
if (module_exists('i18n_string')) {
$labels[$machine_name] = i18n_string_translate(array('workbench_moderation', 'moderation_state', $machine_name, 'label'), $state->label);
}
else {
$labels[$machine_name] = $state->label;
}
}
}
return $labels;
}
/**
* Implements hook_i18n_string_info().
*/
function workbench_moderation_i18n_string_info() {
$groups['workbench_moderation'] = array(
'title' => t('Workbench moderation'),
'description' => t('Translatable workbench moderation states: label.'),
// This group doesn't have strings with format.
'format' => FALSE,
// This group can list all strings.
'list' => TRUE,
);
return $groups;
}
/**
* Implements hook_i18n_string_list().
*/
function workbench_moderation_i18n_string_list($group) {
$strings = array();
if ($group == 'workbench_moderation') {
foreach (workbench_moderation_states() as $state) {
$strings['workbench_moderation']['moderation_state'][$state->name]['label'] = $state->label;
$strings['workbench_moderation']['moderation_state'][$state->name]['description'] = $state->description;
}
}
return $strings;
}
/**
* Get the label for a state based on its machine name.
*
......
......@@ -83,14 +83,15 @@ function workbench_moderation_node_history_view($node) {
drupal_set_title(t('History of %title', array('%title' => $node->title)), PASS_THROUGH);
// Get all of the node revisions, each with its most recent moderation.
$query = db_select('node', 'n');
$query = db_select('node', 'n')->extend('PagerDefault');
$query->leftJoin('node_revision', 'r', 'n.nid = r.nid');
$query->leftJoin('users', 'u', 'r.uid = u.uid');
$query->addField('n', 'vid', 'live_revision');
$query->condition('n.nid', $node->nid)
->orderBy('r.vid', 'DESC')
->fields('r', array('nid', 'vid', 'title', 'log', 'uid', 'timestamp'))
->fields('u', array('name'));
->fields('u', array('name'))
->limit(30);
$revisions = $query->execute()
->fetchAllAssoc('vid');
......@@ -129,14 +130,36 @@ function workbench_moderation_node_history_view($node) {
// Revision operations.
$revision_operations = array();
if (isset($node->workbench_moderation['published']) && $revision->vid == $node->workbench_moderation['published']->vid) {
$revision_operations['view'] = workbench_moderation_access_link(t('View'), "node/{$revision->nid}");
}
elseif ($revision->vid == $node->workbench_moderation['current']->vid) {
$revision_operations['view'] = workbench_moderation_access_link(t('View'), "node/{$revision->nid}/current-revision");
// Loading the node at the specific revision using node_load() is too slow
// when there are many revisions, thus we fake it by cloning the original
// node and changing the 'vid' and the 'my_revision' elements required for
// granting access to the revision operations (view, update/revert, delete).
$node_revision = clone $node;
$node_revision->vid = $revision->vid;
$node_revision->workbench_moderation['my_revision'] = $revision;
// View operation.
if (_workbench_moderation_revision_access($node_revision, 'view')) {
// Link to the node page if this is the published revision.
if (isset($node->workbench_moderation['published']) && $revision->vid == $node->workbench_moderation['published']->vid) {
$url = "node/{$revision->nid}";
}
// The special case "current-revision" link handles routing for the
// current unpublished revision.
elseif ($revision->vid == $node->workbench_moderation['current']->vid) {
$url = "node/{$revision->nid}/current-revision";
}
// Otherwise, link to the normal revision view page.
else {
$url = "node/{$revision->nid}/revisions/{$revision->vid}/view";
}
$revision_operations['view'] = l(t('View'), $url);
}
else {
$revision_operations['view'] = workbench_moderation_access_link(t('View'), "node/{$revision->nid}/revisions/{$revision->vid}/view");
// Revert operation.
if (_workbench_moderation_revision_access($node_revision, 'update')) {
$revision_operations['revert'] = l(t('Revert'), "node/{$revision->nid}/revisions/{$revision->vid}/revert");
}
// Provide a courtesy edit operation if this is the current revision.
......@@ -154,8 +177,10 @@ function workbench_moderation_node_history_view($node) {
$revision_operations['edit'] = l($edit_operation_title, "node/{$revision->nid}/edit", array('query' => array('destination' => "node/{$revision->nid}/moderation")));
}
$revision_operations['revert'] = workbench_moderation_access_link(t('Revert'), "node/{$revision->nid}/revisions/{$revision->vid}/revert");
$revision_operations['delete'] = workbench_moderation_access_link(t('Delete'), "node/{$revision->nid}/revisions/{$revision->vid}/delete");
// Delete operation.
if (_workbench_moderation_revision_access($node_revision, 'delete')) {
$revision_operations['delete'] = l(t('Delete'), "node/{$revision->nid}/revisions/{$revision->vid}/delete");
}
$row['data']['revision'] = implode(' | ', array_filter($revision_operations));
......@@ -236,7 +261,7 @@ function workbench_moderation_node_history_view($node) {
$header = array(t('Revision'), t('Title'), t('Date'), t('Revision actions'), t('Moderation actions'));
// Return properly styled output.
return array(
$build['pager_table'] = array(
'#attached' => array(
'css' => array(
drupal_get_path('module', 'workbench_moderation') . '/css/workbench_moderation.css',
......@@ -246,6 +271,11 @@ function workbench_moderation_node_history_view($node) {
'#header' => $header,
'#rows' => $rows,
);
// Attach the pager theme.
$build['pager_pager'] = array('#theme' => 'pager');
return $build;
}
/**
......
......@@ -27,10 +27,11 @@ function ocio_user_config_ds_layout_settings_info() {
4 => 'summary',
5 => 'field_room_and_building',
6 => 'field_street_address',
7 => 'field_display_in_directory',
7 => 'field_display_on_contact_page',
8 => 'field_display_in_leadership_list',
9 => 'field_first_name',
10 => 'field_last_name',
11 => 'ds_user_picture',
),
),
'fields' => array(
......@@ -41,17 +42,21 @@ function ocio_user_config_ds_layout_settings_info() {
'summary' => 'ds_content',
'field_room_and_building' => 'ds_content',
'field_street_address' => 'ds_content',
'field_display_in_directory' => 'ds_content',
'field_display_on_contact_page' => 'ds_content',
'field_display_in_leadership_list' => 'ds_content',
'field_first_name' => 'ds_content',
'field_last_name' => 'ds_content',
'ds_user_picture' => 'ds_content',
),
'classes' => array(),
'wrappers' => array(),
'wrappers' => array(
'ds_content' => 'div',
'ds_hidden' => 'div',
),
'layout_wrapper' => 'div',
'layout_attributes' => '',
'layout_attributes_merge' => TRUE,
'layout_link_attribute' => FALSE,
'layout_attributes_merge' => 1,
'layout_link_attribute' => '',
'layout_link_custom' => '',
);
$export['user|user|default'] = $ds_layout;
......
......@@ -9,5 +9,6 @@ core = 7.x
projects[role_delegation][version] = 1.1
projects[role_delegation][subdir] = contrib
projects[administerusersbyrole][version] = 2.0-beta1
projects[administerusersbyrole][version] = 2.0-rc1
projects[administerusersbyrole][subdir] = contrib
projects[administerusersbyrole][patch][2557473] = http://drupal.org/files/issues/administerusersbyrole-can_create_user_ajax_submit-2557473-13-D7.patch
<?php
/**
* @file
* wcm_user_contact.context.inc
*/
/**
* Implements hook_context_default_contexts().
*/
function wcm_user_contact_context_default_contexts() {
$export = array();
$context = new stdClass();
$context->disabled = FALSE; /* Edit this to true to make a default context disabled initially */
$context->api_version = 3;
$context->name = 'user-contact-page';
$context->description = '';
$context->tag = 'WCM User Contact';
$context->conditions = array(
'path' => array(
'values' => array(
'contact' => 'contact',
),
),
);
$context->reactions = array(
'block' => array(
'blocks' => array(
'views-user_contact-block_1' => array(
'module' => 'views',
'delta' => 'user_contact-block_1',
'region' => 'content',
'weight' => '-10',
),
),
),
);
$context->condition_mode = 0;
// Translatables
// Included for use with string extractors like potx.
t('WCM User Contact');
$export['user-contact-page'] = $context;
return $export;
}
<?php
/**
* @file
* wcm_user_directory.features.field_base.inc
* wcm_user_contact.features.field_base.inc
*/
/**
* Implements hook_field_default_field_bases().
*/
function wcm_user_directory_field_default_field_bases() {
function wcm_user_contact_field_default_field_bases() {
$field_bases = array();
// Exported field_base: 'field_display_in_directory'
$field_bases['field_display_in_directory'] = array(
// Exported field_base: 'field_display_on_contact_page'
$field_bases['field_display_on_contact_page'] = array(
'active' => 1,
'cardinality' => 1,
'deleted' => 0,
'entity_types' => array(),
'field_name' => 'field_display_in_directory',
'field_name' => 'field_display_on_contact_page',
'indexes' => array(
'value' => array(
0 => 'value',
......@@ -26,8 +26,8 @@ function wcm_user_directory_field_default_field_bases() {
'module' => 'list',
'settings' => array(
'allowed_values' => array(
0 => 'no',
1 => 'yes',
0 => 0,
1 => 1,
),
'allowed_values_function' => '',
),
......
<?php
/**
* @file
* wcm_user_directory.features.field_instance.inc
* wcm_user_contact.features.field_instance.inc
*/
/**
* Implements hook_field_default_field_instances().
*/
function wcm_user_directory_field_default_field_instances() {
function wcm_user_contact_field_default_field_instances() {
$field_instances = array();
// Exported field_instance: 'user-user-field_display_in_directory'
$field_instances['user-user-field_display_in_directory'] = array(
// Exported field_instance: 'user-user-field_display_on_contact_page'
$field_instances['user-user-field_display_on_contact_page'] = array(
'bundle' => 'user',
'default_value' => array(
0 => array(
......@@ -19,50 +19,32 @@ function wcm_user_directory_field_default_field_instances() {
),
),
'deleted' => 0,
'description' => 'Check this box if this person should be included in the departmental "people" directory. ',
'description' => 'Check this box if this person should be included on the contact page.',
'display' => array(
'default' => array(
'label' => 'above',
'module' => 'list',
'settings' => array(),
'type' => 'list_default',
'weight' => 9,
'weight' => 7,
),
'directory' => array(
'label' => 'above',
'settings' => array(),
'type' => 'hidden',
'weight' => 10,
),
'featured' => array(
'full' => array(
'label' => 'above',
'settings' => array(),
'type' => 'hidden',
'weight' => 0,
),
'full' => array(
'label' => 'hidden',
'settings' => array(),
'type' => 'hidden',
'weight' => 8,
),
'leadership_listing' => array(
'label' => 'above',
'settings' => array(),
'type' => 'hidden',
'weight' => 8,
),
'leadership_profile' => array(
'label' => 'above',
'settings' => array(),
'type' => 'hidden',
'weight' => 8,
'weight' => 0,
),
),
'ds_extras_field_template' => '',
'entity_type' => 'user',
'field_name' => 'field_display_in_directory',
'label' => 'Display in Directory',
'field_name' => 'field_display_on_contact_page',
'label' => 'Display on Contact Page',
'required' => 0,
'settings' => array(
'user_register_form' => 1,
......@@ -74,14 +56,14 @@ function wcm_user_directory_field_default_field_instances() {
'display_label' => 1,
),
'type' => 'options_onoff',
'weight' => 8,
'weight' => 10,
),
);
// Translatables
// Included for use with string extractors like potx.
t('Check this box if this person should be included in the departmental "people" directory. ');
t('Display in Directory');
t('Check this box if this person should be included on the contact page.');
t('Display on Contact Page');
return $field_instances;
}
<?php
/**
* @file
* wcm_user_directory.features.inc
* wcm_user_contact.features.inc
*/
/**
* Implements hook_ctools_plugin_api().
*/
function wcm_user_directory_ctools_plugin_api($module = NULL, $api = NULL) {
if ($module == "ds" && $api == "ds") {
return array("version" => "1");
function wcm_user_contact_ctools_plugin_api($module = NULL, $api = NULL) {
if ($module == "context" && $api == "context") {
return array("version" => "3");
}
}
/**
* Implements hook_views_api().
*/
function wcm_user_directory_views_api($module = NULL, $api = NULL) {
function wcm_user_contact_views_api($module = NULL, $api = NULL) {
return array("api" => "3.0");
}
name = WCM User Directory
description = Directory view and settings for a departmental directory on WCM sites.
name = WCM User Contact
description = Creates a user contact page from selected user profiles.
core = 7.x
package = WCM Features
version = 7.x-1.0
project = wcm_user_directory
project = wcm_user_contact
dependencies[] = context
dependencies[] = features
dependencies[] = number
dependencies[] = options
dependencies[] = list
dependencies[] = views
features[ctools][] = ds:ds:1
features[context][] = user-contact-page
features[ctools][] = context:context:3
features[ctools][] = views:views_default:3.0
features[features_api][] = api:2
features[field_base][] = field_display_in_directory
features[field_instance][] = user-user-field_display_in_directory
features[field_base][] = field_display_on_contact_page
features[field_instance][] = user-user-field_display_on_contact_page
features[views_view][] = user_contact
features_exclude[dependencies][ctools] = ctools
features_exclude[dependencies][ds] = ds
features_exclude[dependencies][list] = list
features_exclude[dependencies][options] = options
<?php
/**
* @file
* Code for the WCM User Contact feature.
*/
include_once 'wcm_user_contact.features.inc';
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment