123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117 |
- <?php
- class TripalBundleUIController extends EntityDefaultUIController {
- public function __construct($entity_type, $entity_info) {
- parent::__construct($entity_type, $entity_info);
- }
-
- public function hook_menu() {
- $items = parent::hook_menu();
- $items[$this->path]['description'] = 'Manage biological content types that are
- added using Tripal.';
-
- unset($items[$this->path . '/import']);
- $items[$this->path . '/add'] = array(
- 'title' => 'Add new tripal content type',
- 'description' => 'Add new biological content',
- 'page callback' => 'drupal_get_form',
- 'page arguments' => array('tripal_entities_admin_add_type_form'),
- 'access arguments' => array('administer tripal data types'),
- 'file' => 'includes/tripal_entities.admin.inc',
- 'file path' => drupal_get_path('module', 'tripal_entities'),
- 'type' => MENU_LOCAL_ACTION,
- 'weight' => 2
- );
- return $items;
- }
-
- function hook_forms() {
- $forms = parent::hook_forms();
-
-
-
- $forms[$this->entityType . '_form'] = array(
- 'callback' => 'tripal_entities_tripal_bundle_form',
- 'callback arguments' => array($this->entityType)
- );
- return $forms;
- }
- }
- function tripal_entities_tripal_bundle_form($form, &$form_state, $entityDataType) {
- $form = array();
- $form['message'] = array(
- '#type' => 'item',
- '#markup' => 'Edit the function "tripal_entities_tripal_bundle_form()" ' .
- 'to add a form each type. Put access controls here?',
- );
- return $form;
- }
- function tripal_bundle_access($op, $type = NULL, $account = NULL) {
- return user_access('administer tripal data types', $account);
- }
- function tripal_bundle_form($form, &$form_state, $tripal_bundle, $op = 'edit') {
- if ($op == 'clone') {
- $tripal_bundle->label .= ' (cloned)';
- $tripal_bundle->type = '';
- }
- $form['label'] = array(
- '#title' => t('Label'),
- '#type' => 'textfield',
- '#default_value' => $tripal_bundle->label,
- '#description' => t('The human-readable name of this tripal data type.'),
- '#required' => TRUE,
- '#size' => 30,
- );
- return $form;
- }
- function tripal_bundle_form_submit(&$form, &$form_state) {
- $tripal_bundle = entity_ui_form_submit_build_entity($form, $form_state);
- $tripal_bundle->save();
- $form_state['redirect'] = $this->path;
- }
- function tripal_bundle_form_submit_delete(&$form, &$form_state) {
- $form_state['redirect'] = $this->path;
- }
|