diff --git a/lib/Drupal/profile2/ProfileTypeListController.php b/lib/Drupal/profile2/ProfileTypeListController.php new file mode 100644 index 0000000..bf08708 --- /dev/null +++ b/lib/Drupal/profile2/ProfileTypeListController.php @@ -0,0 +1,38 @@ +uri(); + $operations['manage-fields'] = array( + 'title' => t('manage fields'), + 'href' => $uri['path'] . '/fields', + 'options' => $uri['options'], + 'weight' => 10, + ); + $operations['manage-display'] = array( + 'title' => t('manage display'), + 'href' => $uri['path'] . '/display', + 'options' => $uri['options'], + 'weight' => 10, + ); + return $operations; + } +} diff --git a/profile2.module b/profile2.module index 90132bf..3f6b607 100644 --- a/profile2.module +++ b/profile2.module @@ -68,7 +68,9 @@ function profile2_entity_info() { $return['profile2_type'] = array( 'label' => t('Profile type'), 'entity class' => 'Drupal\profile2\ProfileType', + 'uri callback' => 'profile2_profile_type_uri', 'controller class' => 'Drupal\Core\Config\Entity\ConfigStorageController', + 'list controller class' => 'Drupal\profile2\ProfileTypeListController', 'form controller class' => array( 'default' => 'Drupal\profile2\ProfileTypeFormController', ), @@ -96,6 +98,18 @@ function profile2_profile_uri(Profile $profile) { } /** + * Entity uri callback. + * + * @param Drupal\profile2\ProfileType $profile_type + * A profile type entity. + */ +function profile2_profile_type_uri(ProfileType $profile_type) { + return array( + 'path' => 'admin/structure/profiles/manage/' . $profile_type->id(), + ); +} + +/** * Implements hook_menu(). */ function profile2_menu() { @@ -238,6 +252,9 @@ function profile2_menu_local_tasks_alter(&$data, $router_item, $root_path) { * Page callback; Lists available ProfileType objects. */ function profile2_type_list_page() { + $controller = entity_list_controller('profile2_type'); + return $controller->render(); + $field_ui = module_exists('field_ui'); $header = array(t('Name'), array('data' => t('Operations'), 'colspan' => $field_ui ? 4 : 2)); $rows = array();