Commit 42f2feca authored by RoSk0's avatar RoSk0

Applied Zels patch with path renaming(crm_core_paths_1.patch).

parent 2c736716
......@@ -72,14 +72,14 @@ function crm_core_activity_type_form_submit(&$form, &$form_state) {
}
// Redirect user back to list of activity types.
$form_state['redirect'] = 'admin/structure/crm/activity-types';
$form_state['redirect'] = 'admin/structure/crm-core/activity-types';
}
/**
* Submit handler for deletion button for crm_activity_type.
*/
function crm_core_activity_type_form_submit_delete(&$form, &$form_state) {
$form_state['redirect'] = 'admin/structure/crm/activity-types/manage/' . $form_state['crm_core_activity_type']->type . '/delete';
$form_state['redirect'] = 'admin/structure/activity-types/manage/' . $form_state['crm_core_activity_type']->type . '/delete';
}
/**
......
......@@ -10,7 +10,7 @@ class CRMCoreActivityEntity extends Entity {
protected function defaultUri() {
return array(
'path' => 'crm/activity/' . $this->identifier(),
'path' => 'crm-core/activity/' . $this->identifier(),
'options' => array(
'absolute' => TRUE,
),
......
......@@ -2,7 +2,7 @@ name = CRM Core Activity
description = Provide activity entity.
package = CRM
core = 7.x
configure = crm/admin/activity_types
configure = admin/config/crm-core/activity_types
; =======================
......
......@@ -58,7 +58,7 @@ function crm_core_activity_entity_info() {
'module' => 'crm_core_activity',
// Enable the entity API's admin UI.
'admin ui' => array(
'path' => 'admin/structure/crm/activity-types',
'path' => 'admin/structure/crm-core/activity-types',
'file' => 'crm_core_activity.admin.inc',
'controller class' => 'EntityDefaultUIController',
),
......@@ -79,8 +79,8 @@ function crm_core_activity_entity_info_alter(&$entity_info) {
$entity_info['crm_core_activity']['bundles'][$type] = array(
'label' => $info->label,
'admin' => array(
'path' => 'admin/structure/crm/activity-types/manage/%crm_core_activity_type',
'real path' => 'admin/structure/crm/activity-types/manage/' . $type,
'path' => 'admin/structure/crm-core/activity-types/manage/%crm_core_activity_type',
'real path' => 'admin/structure/crm-core/activity-types/manage/' . $type,
'bundle argument' => 5,
),
);
......@@ -409,7 +409,7 @@ function crm_core_activity_crm_core_contact_delete($crm_core_contact) {
*/
function crm_core_activity_search_info() {
return array(
'title' => 'CRM Activities',
'title' => 'CRM Core Activities',
'path' => 'activity',
);
}
......
......@@ -38,7 +38,7 @@ class crm_core_activity_handler_field_link extends views_handler_field {
$text = !empty($this->options['text']) ? $this->options['text'] : t('view');
$activity_id = $this->get_value($values, 'activity_id');
return l($text, 'crm/activity/' . $activity_id);
return l($text, 'crm-core/activity/' . $activity_id);
}
}
......@@ -67,10 +67,10 @@ class crm_core_activity_handler_field_link_edit extends crm_core_activity_handle
$activity_id = $this->get_value($values, 'activity_id');
if ($this->options['redirect']) {
return l($text, 'crm/activity/' . $activity_id . '/edit', array('query' => array('destination' => $_GET['q'])));
return l($text, 'crm-core/activity/' . $activity_id . '/edit', array('query' => array('destination' => $_GET['q'])));
}
else {
return l($text, 'crm/activity/' . $activity_id . '/edit');
return l($text, 'crm-core/activity/' . $activity_id . '/edit');
}
}
}
......@@ -81,10 +81,10 @@ class crm_core_activity_handler_field_link_delete extends crm_core_activity_hand
$activity_id = $this->get_value($values, 'activity_id');
if ($this->options['redirect']) {
return l($text, 'crm/activity/' . $activity_id . '/delete', array('query' => array('destination' => $_GET['q'])));
return l($text, 'crm-core/activity/' . $activity_id . '/delete', array('query' => array('destination' => $_GET['q'])));
}
else {
return l($text, 'crm/activity/' . $activity_id . '/delete');
return l($text, 'crm-core/activity/' . $activity_id . '/delete');
}
}
}
......
......@@ -6,7 +6,7 @@
* Needed for building view crm_activity_types to show the list of available
* activity types that we can create activity.
*
* Link to be build: 'crm/contact/' . [node nid] . '/activity/add/' . [activity type machine name].
* Link to be build: 'crm-core/contact/' . [node nid] . '/activity/add/' . [activity type machine name].
*/
class views_handler_field_activity_type extends views_handler_field {
function option_definition() {
......@@ -30,7 +30,7 @@ class views_handler_field_activity_type extends views_handler_field {
if ($this->options['alter']['activity_create_link']) {
$value = $this->last_render;
if (isset($this->view->args[0])) {
return 'crm/contact/' . $this->view->args[0] . '/activity/add/' . $value;
return 'crm-core/contact/' . $this->view->args[0] . '/activity/add/' . $value;
}
}
return parent::render_text($alter);
......
......@@ -9,7 +9,7 @@ function crm_core_activity_ui_menu() {
/*
* Contact Activities
*/
/*$items['crm/contact/%crm_core_contact/activity'] = array(
/*$items['crm-core/contact/%crm_core_contact/activity'] = array(
'title' => 'Activity',
'description' => 'View contact activity',
'page callback' => 'crm_core_contact_activity',
......@@ -22,7 +22,7 @@ function crm_core_activity_ui_menu() {
// Menu items for creation of new Activities.
foreach (crm_core_activity_types() as $type => $info) {
$items['crm/contact/%crm_core_contact/activity/add/' . $type] = array(
$items['crm-core/contact/%crm_core_contact/activity/add/' . $type] = array(
'title' => 'Add Activity',
'description' => 'Add an activity to this contact',
'page callback' => 'crm_core_activity_entity_ui_get_form_wrapper',
......@@ -34,7 +34,7 @@ function crm_core_activity_ui_menu() {
);
}
$items['crm/activity/%crm_core_activity'] = array(
$items['crm-core/activity/%crm_core_activity'] = array(
'title' => 'Activity',
'page callback' => 'crm_core_activity_view',
'page arguments' => array(2),
......@@ -45,14 +45,14 @@ function crm_core_activity_ui_menu() {
'type' => MENU_NORMAL_ITEM,
);
$items['crm/activity/%crm_core_activity/view'] = array(
$items['crm-core/activity/%crm_core_activity/view'] = array(
'title' => 'View',
'weight' => -10,
'type' => MENU_DEFAULT_LOCAL_TASK,
'context' => MENU_CONTEXT_PAGE | MENU_CONTEXT_INLINE,
);
$items['crm/activity/%crm_core_activity/edit'] = array(
$items['crm-core/activity/%crm_core_activity/edit'] = array(
'title' => 'Edit',
'page callback' => 'entity_ui_get_form',
'page arguments' => array('crm_core_activity', 2, 'edit'),
......@@ -62,7 +62,7 @@ function crm_core_activity_ui_menu() {
'file' => 'crm_core_activity_ui.pages.inc',
);
$items['crm/activity/%crm_core_activity/delete'] = array(
$items['crm-core/activity/%crm_core_activity/delete'] = array(
'title' => 'Delete',
'page callback' => 'drupal_get_form',
'page arguments' => array('crm_core_activity_form_delete_confirm', 2),
......@@ -73,7 +73,7 @@ function crm_core_activity_ui_menu() {
'file' => 'crm_core_activity_ui.pages.inc',
);
$items['admin/structure/crm/activity-types/list'] = array(
$items['admin/structure/crm-core/activity-types/list'] = array(
'title' => 'List',
'weight' => -10,
'type' => MENU_DEFAULT_LOCAL_TASK,
......@@ -86,11 +86,11 @@ function crm_core_activity_ui_menu() {
* Implements hook_menu_alter().
*/
function crm_core_activity_ui_menu_alter(&$items) {
$items['admin/structure/crm/activity-types']['type'] = MENU_LOCAL_TASK;
$items['admin/structure/crm-core/activity-types']['type'] = MENU_LOCAL_TASK;
// Set "Add activity" as local action.
$items['crm/contact/%/activity/add']['type'] = MENU_LOCAL_ACTION;
$items['crm/contact/%/activity/add']['context'] = MENU_CONTEXT_PAGE;
unset($items['crm/contact/%/activity/add']['tab_root']);
$items['crm-core/contact/%/activity/add']['type'] = MENU_LOCAL_ACTION;
$items['crm-core/contact/%/activity/add']['context'] = MENU_CONTEXT_PAGE;
unset($items['crm-core/contact/%/activity/add']['tab_root']);
}
/**
......@@ -106,12 +106,12 @@ function crm_core_activity_ui_admin_menu_map() {
);
}
$map['admin/structure/crm/activity-types/manage/%crm_core_activity_type'] = array(
$map['admin/structure/crm-core/activity-types/manage/%crm_core_activity_type'] = array(
// Link generated items directly to the "Activity Types" item.
'parent' => 'admin/structure/crm/activity-types',
'parent' => 'admin/structure/crm-core/activity-types',
// Hide the "List" item, as this expansion will expose all available
// options.
'hide' => 'admin/structure/crm/activity-types/list',
'hide' => 'admin/structure/crm-core/activity-types/list',
// Create expansion arguments for the '%crm_core_activity_type' placeholder.
'arguments' => $arguments,
);
......
......@@ -31,7 +31,7 @@ function crm_core_activity_entity_ui_get_form_wrapper($contact, $type) {
*/
function crm_core_activity_form($form, &$form_state, $activity) {
// Ensure this include file is loaded when the form is rebuilt from the cache.
$form_state['build_info']['files'][] =
$form_state['build_info']['files'][] =
drupal_get_path('module', 'crm_core_activity_ui') . '/crm_core_activity_ui.pages.inc';
// get the contact id of who is trying to add the activity
if (isset($activity->field_activity_participants['und']['0'])) {
......@@ -157,7 +157,7 @@ function crm_core_activity_form_submit($form, &$form_state) {
drupal_set_message(t('Activity @title edited.', array('@title' => $activity->title)));
}
$form_state['redirect'] = 'crm/activity/' . $activity->activity_id;
$form_state['redirect'] = 'crm-core/activity/' . $activity->activity_id;
}
/**
......@@ -172,7 +172,7 @@ function crm_core_activity_form_submit_delete($form, &$form_state) {
unset($_GET['destination']);
}
$activity = $form_state['crm_core_activity'];
$form_state['redirect'] = array('crm/activity/' . $activity->activity_id . '/delete', array('query' => $destination));
$form_state['redirect'] = array('crm-core/activity/' . $activity->activity_id . '/delete', array('query' => $destination));
}
function crm_core_activity_form_delete_confirm($form, &$form_state, $activity) {
......@@ -181,7 +181,7 @@ function crm_core_activity_form_delete_confirm($form, &$form_state, $activity) {
$form['activity_id'] = array('#type' => 'value', '#value' => $activity->activity_id);
return confirm_form($form,
t('Are you sure you want to delete activity %title?', array('%title' => $activity->title)),
'crm/activity/' . $activity->activity_id,
'crm-core/activity/' . $activity->activity_id,
t('This action cannot be undone.'),
t('Delete'),
t('Cancel')
......
......@@ -39,13 +39,13 @@ class CRMCoreActivityUITestCase extends DrupalWebTestCase {
$household_contact = array(
'contact_name[und][0][given]' => $this->randomName(),
);
$this->drupalPost('crm/contact/add/household', $household_contact, t('Save Contact'));
$this->drupalPost('crm-core/contact/add/household', $household_contact, t('Save Contact'));
$this->drupalGet('crm/contact/1/activity');
$this->drupalGet('crm-core/contact/1/activity');
$this->assertText(t('This contact has no activity, add an activity above.'), t('No activities avaiable for newly created contact.'));
$this->assertLink(t('Add Activity'));
$this->drupalGet('crm/contact/1/activity/add');
$this->drupalGet('crm-core/contact/1/activity/add');
$this->assertLink(t('Meeting'));
$this->assertLink(t('Phone call'));
......@@ -56,7 +56,7 @@ class CRMCoreActivityUITestCase extends DrupalWebTestCase {
'field_activity_date[und][0][value][time]' => $this->randomTime(),
'field_activity_notes[und][0][value]' => $this->randomString(),
);
$this->drupalPost('crm/contact/1/activity/add/meeting', $meeting_activity, t('Save Activity'));
$this->drupalPost('crm-core/contact/1/activity/add/meeting', $meeting_activity, t('Save Activity'));
$this->assertNoRaw('<div class="messages error">', t('No errors after adding new activity.'));
// Create Meeting activity. Ensure it it listed.
......@@ -66,7 +66,7 @@ class CRMCoreActivityUITestCase extends DrupalWebTestCase {
'field_activity_date[und][0][value][time]' => $this->randomTime(),
'field_activity_notes[und][0][value]' => $this->randomString(),
);
$this->drupalPost('crm/contact/1/activity/add/phone_call', $phonecall_activity, t('Save Activity'));
$this->drupalPost('crm-core/contact/1/activity/add/phone_call', $phonecall_activity, t('Save Activity'));
$this->assertNoRaw('<div class="messages error">', t('No errors after adding new activity.'));
// Update activity and assert its title changed on the list.
......@@ -76,10 +76,10 @@ class CRMCoreActivityUITestCase extends DrupalWebTestCase {
'field_activity_date[und][0][value][time]' => $this->randomTime(),
'field_activity_notes[und][0][value]' => $this->randomString(),
);
$this->drupalPost('crm/activity/1/edit', $meeting_activity, t('Save Activity'));
$this->drupalPost('crm-core/activity/1/edit', $meeting_activity, t('Save Activity'));
$this->assertNoRaw('<div class="messages error">', t('No errors after updating activity.'));
$this->assertText($meeting_activity['title'], t('Activity updated.'));
$this->drupalGet('crm/contact/1/activity');
$this->drupalGet('crm-core/contact/1/activity');
$this->assertRaw($meeting_activity['title'], t('Updated activity listed properly.'));
// Update phone call activity and assert its title changed on the list.
......@@ -89,25 +89,25 @@ class CRMCoreActivityUITestCase extends DrupalWebTestCase {
'field_activity_date[und][0][value][time]' => $this->randomTime(),
'field_activity_notes[und][0][value]' => $this->randomString(),
);
$this->drupalPost('crm/activity/2/edit', $phonecall_activity, t('Save Activity'));
$this->drupalPost('crm-core/activity/2/edit', $phonecall_activity, t('Save Activity'));
$this->assertNoRaw('<div class="messages error">', t('No errors after updating activity.'));
$this->assertText($phonecall_activity['title'], t('Activity updated.'));
$this->drupalGet('crm/contact/1/activity');
$this->drupalGet('crm-core/contact/1/activity');
$this->assertRaw($phonecall_activity['title'], t('Updated activity listed properly.'));
// Delete Meeting activity.
$this->drupalPost('crm/activity/1/delete', array(), t('Delete'));
$this->drupalPost('crm-core/activity/1/delete', array(), t('Delete'));
$this->assertNoRaw('<div class="messages error">', t('No errors after deleting activity.'));
$this->assertNoRaw($meeting_activity['title'] . ' </td>', t('Deleted activity is no more listed.'));
// Delete Phone call activity.
$this->drupalPost('crm/activity/2/delete', array(), t('Delete'));
$this->drupalPost('crm-core/activity/2/delete', array(), t('Delete'));
$this->assertNoRaw('<div class="messages error">', t('No errors after deleting activity.'));
$this->drupalGet('crm/contact/1/activity');
$this->drupalGet('crm-core/contact/1/activity');
$this->assertNoRaw($phonecall_activity['title'] . ' </td>', t('Deleted activity is no more listed.'));
// Assert there is no activities left.
$this->drupalGet('crm/contact/1/activity');
$this->drupalGet('crm-core/contact/1/activity');
$this->assertText(t('This contact has no activity, add an activity above.'), t('No activities listed.'));
}
......@@ -124,4 +124,4 @@ class CRMCoreActivityUITestCase extends DrupalWebTestCase {
function randomTime() {
return rand(0, 23) . ':' . rand(0, 60);
}
}
\ No newline at end of file
}
......@@ -70,11 +70,11 @@ function crm_core_case_type_form_submit(&$form, &$form_state) {
}
// Redirect user back to list of case types.
$form_state['redirect'] = 'admin/structure/crm/case-types';
$form_state['redirect'] = 'admin/structure/crm-core/case-types';
}
function crm_core_case_type_form_submit_delete(&$form, &$form_state) {
$form_state['redirect'] = 'admin/structure/crm/case-types/' . $form_state['crm_core_case_type']->type . '/delete';
$form_state['redirect'] = 'admin/structure/crm-core/case-types/' . $form_state['crm_core_case_type']->type . '/delete';
}
/**
......@@ -86,7 +86,7 @@ function crm_core_case_type_form_delete_confirm($form, &$form_state, $case_type)
$form['case_type_id'] = array('#type' => 'value', '#value' => $case_type->id);
return confirm_form($form,
t('Are you sure you want to delete Case type %title?', array('%title' => $case_type->label)),
'crm/case/' . $case_type->id,
'crm-core/case/' . $case_type->id,
t('This action cannot be undone.'),
t('Delete'),
t('Cancel')
......@@ -103,7 +103,7 @@ function crm_core_case_type_form_delete_confirm_submit($form, &$form_state) {
watchdog('crm_core_case_type', '@type: deleted %title.', array('@type' => $case_type->type, '%title' => $case_type->label));
drupal_set_message(t('@type %title has been deleted.', array('@type' => $case_type->type, '%title' => $case_type->label)));
$form_state['redirect'] = 'admin/structure/crm/case-types';
$form_state['redirect'] = 'admin/structure/crm-core/case-types';
}
function crm_core_case_admin_page() {
......@@ -113,7 +113,7 @@ function crm_core_case_admin_page() {
function crm_core_case_admin_add_page() {
$items = array();
foreach (crm_core_case_types() as $case_type_key => $case_type) {
$items[] = l($case_type->label, 'crm/case/add/' . $case_type_key);
$items[] = l($case_type->label, 'crm-core/case/add/' . $case_type_key);
}
return array('list' => array('#theme' => 'item_list', '#items' => $items, '#title' => t('Select type of case to create.')));
}
......
......@@ -53,7 +53,7 @@ function crm_core_case_context_page_condition() {
}
}
// Also execute context on case add page.
if (strpos($_GET['q'], 'crm/case/add/') !== FALSE) {
if (strpos($_GET['q'], 'crm-core/case/add/') !== FALSE) {
$contact = entity_create('crm_core_case', array('type' => arg(3)));
$op = 'edit';
}
......
......@@ -60,7 +60,7 @@ function crm_core_case_entity_info() {
'module' => 'crm_core_case',
// Enable the entity API's admin UI.
'admin ui' => array(
'path' => 'admin/structure/crm/case-types',
'path' => 'admin/structure/crm-core/case-types',
'file' => 'crm_core_case.admin.inc',
'controller class' => 'CRMCaseTypeUIController',
),
......@@ -81,8 +81,8 @@ function crm_core_case_entity_info_alter(&$entity_info) {
$entity_info['crm_core_case']['bundles'][$type] = array(
'label' => $info->label,
'admin' => array(
'path' => 'admin/structure/crm/case-types/manage/%crm_core_case_type',
'real path' => 'admin/structure/crm/case-types/manage/' . $type,
'path' => 'admin/structure/crm-core/case-types/manage/%crm_core_case_type',
'real path' => 'admin/structure/crm-core/case-types/manage/' . $type,
'bundle argument' => 5,
),
);
......@@ -147,14 +147,14 @@ function crm_core_case_permission() {
function crm_core_case_menu() {
$items = array();
// $items['admin/structure/crm/case'] = array(
// $items['admin/structure/crm-core/case'] = array(
// 'title' => 'Cases',
// 'page callback' => 'crm_core_case_admin_page',
// 'access arguments' => array('administer crm_core_case entities'),
// 'file' => 'crm_core_case.admin.inc',
// );
$items['crm/case/add'] = array(
$items['crm-core/case/add'] = array(
'title' => 'Add Case',
'page callback' => 'crm_core_case_admin_add_page',
'access arguments' => array('administer crm_core_case entities'),
......@@ -207,7 +207,7 @@ function crm_core_case_menu() {
);
foreach (crm_core_case_types() as $type => $info) {
$items['crm/case/add/' . $type] = array(
$items['crm-core/case/add/' . $type] = array(
'title' => 'Add case',
'page callback' => 'crm_core_case_add',
'page arguments' => array(3),
......@@ -217,7 +217,7 @@ function crm_core_case_menu() {
);
}
$items['admin/structure/crm/case-types/%crm_core_case_type/delete'] = array(
$items['admin/structure/crm-core/case-types/%crm_core_case_type/delete'] = array(
'title' => 'Delete',
'page callback' => 'drupal_get_form',
'page arguments' => array('crm_core_case_type_form_delete_confirm', 4),
......@@ -231,7 +231,7 @@ function crm_core_case_menu() {
}
function crm_core_case_menu_alter(&$items) {
$items['admin/structure/crm/case-types']['type'] = MENU_LOCAL_TASK;
$items['admin/structure/crm-core/case-types']['type'] = MENU_LOCAL_TASK;
}
/**
......@@ -293,7 +293,7 @@ function crm_core_case_label($case) {
}
function crm_core_case_uri($case) {
return array('path' => 'crm/case/' . $case->cid);
return array('path' => 'crm-core/case/' . $case->cid);
}
/**
......
......@@ -44,7 +44,7 @@ function crm_core_case_views_default_views() {
$handler->display->display_options['fields']['title']['label'] = 'Name';
$handler->display->display_options['fields']['title']['alter']['alter_text'] = 0;
$handler->display->display_options['fields']['title']['alter']['make_link'] = 1;
$handler->display->display_options['fields']['title']['alter']['path'] = 'crm/case/[cid]';
$handler->display->display_options['fields']['title']['alter']['path'] = 'crm-core/case/[cid]';
$handler->display->display_options['fields']['title']['alter']['absolute'] = 0;
$handler->display->display_options['fields']['title']['alter']['external'] = 0;
$handler->display->display_options['fields']['title']['alter']['replace_spaces'] = 0;
......@@ -88,7 +88,7 @@ function crm_core_case_views_default_views() {
$handler->display->display_options['fields']['nothing']['label'] = 'Edit';
$handler->display->display_options['fields']['nothing']['alter']['text'] = 'Edit';
$handler->display->display_options['fields']['nothing']['alter']['make_link'] = 1;
$handler->display->display_options['fields']['nothing']['alter']['path'] = 'crm/case/[cid]/edit';
$handler->display->display_options['fields']['nothing']['alter']['path'] = 'crm-core/case/[cid]/edit';
$handler->display->display_options['fields']['nothing']['alter']['absolute'] = 0;
$handler->display->display_options['fields']['nothing']['alter']['external'] = 0;
$handler->display->display_options['fields']['nothing']['alter']['replace_spaces'] = 0;
......@@ -112,7 +112,7 @@ function crm_core_case_views_default_views() {
/* Display: Page */
$handler = $view->new_display('page', 'Page', 'page');
$handler->display->display_options['path'] = 'crm/case';
$handler->display->display_options['path'] = 'crm-core/case';
$handler->display->display_options['menu']['type'] = 'tab';
$handler->display->display_options['menu']['title'] = 'Cases';
$handler->display->display_options['menu']['weight'] = '0';
......
......@@ -4,9 +4,9 @@
?>
<div id="contact-<?php print $type . '-' . $cid; ?>" class="<?php print $classes; ?> clearfix"<?php print $attributes; ?>>
<?php if ($view_mode !== 'full'): ?>
<h2<?php print $title_attributes; ?>><a href="<?php print base_path(); ?>crm/contact/<?php print $cid; ?>"><?php print render($contact_data['contact_name']); ?></a></h2>
<h2<?php print $title_attributes; ?>><a href="<?php print base_path(); ?>crm-core/contact/<?php print $cid; ?>"><?php print render($contact_data['contact_name']); ?></a></h2>
<?php endif; ?>
<?php if ($view_mode === 'full'): ?>
<?php print render($contact_data); ?>
<?php endif; ?>
</div>
\ No newline at end of file
</div>
......@@ -128,6 +128,6 @@ function crm_core_contact_type_form_submit($form, &$form_state) {
crm_core_contact_type_save($contact_type);
// Redirect based on the button clicked.
$form_state['redirect'] = 'admin/structure/crm/contact-types/';
$form_state['redirect'] = 'admin/structure/crm-core/contact-types/';
drupal_set_message(t('Contact type saved.'));
}
......@@ -53,7 +53,7 @@ function crm_core_contact_context_page_condition() {
}
}
// Also execute context on contact add page.
if (strpos($_GET['q'], 'crm/contact/add') !== FALSE) {
if (strpos($_GET['q'], 'crm-core/contact/add') !== FALSE) {
$contact = entity_create('crm_core_contact', array('type' => arg(3)));
$op = 'edit';
}
......
......@@ -61,7 +61,7 @@ function crm_core_contact_entity_info() {
'module' => 'crm_core_contact',
// Enable the entity API's admin UI.
'admin ui' => array(
'path' => 'admin/structure/crm/contact-types',
'path' => 'admin/structure/crm-core/contact-types',
'file' => 'crm_core_contact.admin.inc',
'controller class' => 'EntityDefaultUIController',
),
......@@ -83,8 +83,8 @@ function crm_core_contact_entity_info_alter(&$entity_info) {
$entity_info['crm_core_contact']['bundles'][$type] = array(
'label' => $name,
'admin' => array(
'path' => 'admin/structure/crm/contact-types/manage/%crm_core_contact_type',
'real path' => 'admin/structure/crm/contact-types/manage/' . $type,
'path' => 'admin/structure/crm-core/contact-types/manage/%crm_core_contact_type',
'real path' => 'admin/structure/crm-core/contact-types/manage/' . $type,
'bundle argument' => 5,
'access arguments' => array('administer contact types'),
),
......@@ -241,7 +241,7 @@ function crm_core_contact_views_api() {
*/
function crm_core_contact_search_info() {
return array(
'title' => 'CRM Contacts',
'title' => 'CRM Core Contacts',
'path' => 'contact',
);
}
......@@ -721,7 +721,7 @@ function crm_core_contact_view($contact, $view_mode = 'full') {
'#type' => $contact->type,
'#view_mode' => $view_mode,
'#language' => $langcode,
);
);
$build = $contact->content;
return $build;
......@@ -743,24 +743,24 @@ function crm_core_contact_theme($existing, $type, $theme, $path) {
/**
* Process variables for contact.tpl.php
*
* This function simply adds template suggestions for various
* This function simply adds template suggestions for various
* contact types.
*
*/
function template_preprocess_contact(&$variables) {
// hide the label on the name field, when we are looking at something
// besides a full view mode
if($variables['view_mode'] !== 'full'){
$variables['contact_data']['contact_name']['#label_display'] = 'hidden';
}
// add classes based on the type of contact
$variables['classes_array'][] = 'contact-' . $variables['type'];
// add template suggestions
$variables['theme_hook_suggestions'][] = 'contact__' . $variables['type'];
}
/**
......
......@@ -10,7 +10,7 @@ class CRMCoreContactEntity extends Entity {
protected function defaultUri() {
return array(
'path' => 'crm/contact/' . $this->identifier(),
'path' => 'crm-core/contact/' . $this->identifier(),
'options' => array(
'absolute' => TRUE,
),
......
......@@ -43,7 +43,7 @@ class crm_core_contact_handler_field_contact extends views_handler_field {
function render_link($data, $values) {
if (!empty($this->options['link_to_contact']) && $data !== NULL && $data !== '') {
$this->options['alter']['make_link'] = TRUE;
$this->options['alter']['path'] = 'crm/contact/' . $values->{$this->aliases['contact_id']};
$this->options['alter']['path'] = 'crm-core/contact/' . $values->{$this->aliases['contact_id']};
}
return $data;
......
......@@ -37,6 +37,6 @@ class crm_core_contact_handler_field_contact extends views_handler_field {
$text = !empty($this->options['text']) ? $this->options['text'] : t('view');
$contact_id = $values->{$this->aliases['contact_id']};
return l($text, 'crm/contact/' . $contact_id);
return l($text, 'crm-core/contact/' . $contact_id);
}
}
......@@ -52,7 +52,7 @@ class crm_core_contact_handler_field_contact_revert extends views_handler_field
}
$this->options['alter']['make_link'] = TRUE;
$this->options['alter']['path'] = 'crm/contact/' . $values->{$this->aliases['contact_id']} . '/revert/' . $values->{$this->aliases['vid']};
$this->options['alter']['path'] = 'crm-core/contact/' . $values->{$this->aliases['contact_id']} . '/revert/' . $values->{$this->aliases['vid']};
$text = !empty($this->options['text']) ? $this->options['text'] : t('revert');
return $text;
......@@ -62,4 +62,4 @@ class crm_core_contact_handler_field_contact_revert extends views_handler_field
return $this->render_link('', $values);
}
}
\ No newline at end of file
}
......@@ -45,7 +45,7 @@ class crm_core_contact_handler_field_contact_revision extends views_handler_fiel
function render_link($data, $values) {
if (!empty($this->options['link_to_revision']) && $data !== NULL && $data !== '') {
$this->options['alter']['make_link'] = TRUE;
$this->options['alter']['path'] = 'crm/contact/' . $values->{$this->aliases['contact_id']} . '/revert/' . $values->{$this->aliases['vid']};
$this->options['alter']['path'] = 'crm-core/contact/' . $values->{$this->aliases['contact_id']} . '/revert/' . $values->{$this->aliases['vid']};
}
return $data;
......
......@@ -37,6 +37,6 @@ class crm_core_contact_handler_field_contact_revision extends views_handler_fiel
$text = !empty($this->options['text']) ? $this->options['text'] : t('view');
$vid = $values->{$this->aliases['vid']};
return l($text, 'crm/contact/' . $vid);
return l($text, 'crm-core/contact/' . $vid);
}
}
......@@ -5,7 +5,7 @@
* @file
* Handle the 'crm_core_contact view' override task.
*
* This plugin overrides crm/contact/%crm_core_contact and reroutes it to the page manager, where
* This plugin overrides crm-core/contact/%crm_core_contact and reroutes it to the page manager, where
* a list of tasks can be used to service this request based upon criteria
* supplied by access plugins.
*/
......@@ -22,10 +22,10 @@ function crm_core_contact_view_page_manager_tasks() {
'title' => t('Contact template'),
'admin title' => t('Contact template'),
'admin description' => t('When enabled, this overrides the default Drupal behavior for displaying contacts at <em>crm/contact/%crm_core_contact</em>. If you add variants, you may use selection criteria such as contact type or language or user access to provide different views of contacts. If no variant is selected, the default Drupal contact view will be used. This page only affects contacts viewed as pages, it will not affect contacts viewed in lists or at other locations. Also please note that if you are using pathauto, aliases may make a contact to be somewhere else, but as far as Drupal is concerned, they are still at crm/contact/%crm_core_contact.'),
'admin path' => 'crm/contact/%crm_core_contact',
'admin description' => t('When enabled, this overrides the default Drupal behavior for displaying contacts at <em>crm-core/contact/%crm_core_contact</em>. If you add variants, you may use selection criteria such as contact type or language or user access to provide different views of contacts. If no variant is selected, the default Drupal contact view will be used. This page only affects contacts viewed as pages, it will not affect contacts viewed in lists or at other locations. Also please note that if you are using pathauto, aliases may make a contact to be somewhere else, but as far as Drupal is concerned, they are still at crm-core/contact/%crm_core_contact.'),
'admin path' => 'crm-core/contact/%crm_core_contact',
// Menu hooks so that we can alter the crm/contact/%crm_core_contact menu entry to point to us.
// Menu hooks so that we can alter the crm-core/contact/%crm_core_contact menu entry to point to us.
'hook menu' => 'crm_core_contact_view_menu',
'hook menu alter' => 'crm_core_contact_view_menu_alter',
......@@ -54,17 +54,17 @@ function crm_core_contact_view_menu_alter(&$items, $task) {
}
// Override the crm_core_contact view handler for our purpose.
$callback = $items['crm/contact/%crm_core_contact']['page callback'];
$callback = $items['crm-core/contact/%crm_core_contact']['page callback'];
if ($callback == 'crm_core_contact_view' || variable_get('page_manager_override_anyway', FALSE)) {
$items['crm/contact/%crm_core_contact']['page callback'] = 'crm_core_contact_view_page';
$items['crm/contact/%crm_core_contact']['file path'] = $task['path'];
$items['crm/contact/%crm_core_contact']['file'] = $task['file'];
$items['crm-core/contact/%crm_core_contact']['page callback'] = 'crm_core_contact_view_page';
$items['crm-core/contact/%crm_core_contact']['file path'] = $task['path'];
$items['crm-core/contact/%crm_core_contact']['file'] = $task['file'];
}
else {
// automatically disable this task if it cannot be enabled.
variable_set('page_manager_crm_core_contact_view_disabled', TRUE);
if (!empty($GLOBALS['page_manager_enabling_crm_core_contact_view'])) {
drupal_set_message(t('Page manager module is unable to enable crm/contact/%crm_core_contact because some other module already has overridden with %callback.', array('%callback' => $callback)), 'error');