You are here

class EntityformUIController in Entityform 7

Same name and namespace in other branches
  1. 7.2 entityform.admin.inc \EntityformUIController

UI controller.

Hierarchy

Expanded class hierarchy of EntityformUIController

1 string reference to 'EntityformUIController'
entityform_entity_info in ./entityform.module
Implement hook_entity_info().

File

./entityform.admin.inc, line 15
Entityform editing UI.

View source
class EntityformUIController extends EntityDefaultUIController {

  /**
   * Overrides hook_menu() defaults. Main reason for doing this is that
   * parent class hook_menu() is optimized for entity type administration.
   */
  public function hook_menu() {

    //$entityform_base_path = variable_get('entityform_base_path', $)
    $items = array();
    $id_count = count(explode('/', $this->path));
    $front_id_count = count(explode('/', $this->entityInfo['admin ui']["front path"]));
    $wildcard = isset($this->entityInfo['admin ui']['menu wildcard']) ? $this->entityInfo['admin ui']['menu wildcard'] : '%' . $this->entityType;
    $items[$this->path] = array(
      'title' => 'Entityforms',
      'description' => 'Add edit and update entityforms.',
      'page callback' => 'system_admin_menu_block_page',
      'access arguments' => array(
        'access administration pages',
      ),
      'file path' => drupal_get_path('module', 'system'),
      'file' => 'system.admin.inc',
    );

    // Change the overview menu type for the list of entityforms.
    $items[$this->path]['type'] = MENU_LOCAL_TASK;
    $items['eform/submit/%entityform_empty'] = array(
      'title callback' => 'entityform_page_title',
      'title arguments' => array(
        2,
        1,
      ),
      'page callback' => 'entityform_form_wrapper',
      'page arguments' => array(
        2,
        'submit',
      ),
      'access callback' => 'entityform_access',
      'access arguments' => array(
        'submit',
        2,
      ),
      'file' => 'entityform.admin.inc',
      'file path' => drupal_get_path('module', $this->entityInfo['module']),
      'type' => MENU_CALLBACK,
    );
    $items['eform/%entityform_type/confirm'] = array(
      'title callback' => 'entityform_type_page_title',
      'title arguments' => array(
        1,
        'confirm',
      ),
      'description' => '',
      'page callback' => 'entityform_confirm_page',
      'page arguments' => array(
        1,
        3,
      ),
      'access callback' => 'entityform_access',
      'access arguments' => array(
        'confirm',
        1,
      ),
    );
    $items['eform/%entityform_type/draft'] = array(
      'title' => 'Form Saved',
      'description' => '',
      'page callback' => 'entityform_draft_page',
      'page arguments' => array(
        1,
      ),
      'access callback' => TRUE,
      'access arguments' => array(
        'draft_save',
        1,
      ),
    );
    $items['eform/%entityform_type/submissions'] = array(
      'title callback' => 'entityform_type_page_title',
      'title arguments' => array(
        1,
        'view submissions',
      ),
      'description' => '',
      'page callback' => 'entityform_submission_page',
      'page arguments' => array(
        1,
        3,
        'user',
      ),
      'access arguments' => array(
        'view own entityform',
      ),
    );
    $types = array_keys(entityform_get_types());
    $controller = entity_ui_controller('entityform');

    // Loading and editing entityform entities
    $items['entityform/' . $wildcard] = array(
      'page callback' => 'entityform_form_wrapper',
      'page arguments' => array(
        $id_count + 1,
      ),
      'access callback' => 'entityform_access',
      'access arguments' => array(
        'edit',
        $id_count + 1,
      ),
      'weight' => 0,
      'context' => MENU_CONTEXT_PAGE | MENU_CONTEXT_INLINE,
      'file' => 'entityform.admin.inc',
      'file path' => drupal_get_path('module', $this->entityInfo['module']),
    );
    $items['entityform/' . $wildcard . '/edit'] = array(
      'title' => 'Edit',
      'page callback' => 'entityform_form_wrapper',
      'page arguments' => array(
        1,
        'edit',
      ),
      'access callback' => 'entityform_access',
      'access arguments' => array(
        'edit',
        1,
      ),
      'weight' => 0,
      'type' => MENU_LOCAL_TASK,
      'context' => MENU_CONTEXT_PAGE | MENU_CONTEXT_INLINE,
      'file' => 'entityform.admin.inc',
      'file path' => drupal_get_path('module', $this->entityInfo['module']),
    );
    $items['entityform/' . $wildcard . '/delete'] = array(
      'title' => 'Delete',
      'page callback' => 'entityform_delete_form_wrapper',
      'page arguments' => array(
        1,
      ),
      'access callback' => 'entityform_access',
      'access arguments' => array(
        'delete',
        1,
      ),
      'type' => MENU_LOCAL_TASK,
      'context' => MENU_CONTEXT_PAGE | MENU_CONTEXT_INLINE,
      'weight' => 10,
      'file' => 'entityform.admin.inc',
      'file path' => drupal_get_path('module', $this->entityInfo['module']),
    );

    // Menu item for viewing entityforms
    $items['entityform/' . $wildcard] = array(
      //'title' => 'Title',
      'title callback' => 'entityform_page_title',
      'title arguments' => array(
        1,
      ),
      'page callback' => 'entityform_page_view',
      'page arguments' => array(
        1,
      ),
      'access callback' => 'entityform_access',
      'access arguments' => array(
        'view',
        1,
      ),
      'type' => MENU_CALLBACK,
    );
    $items['entityform/' . $wildcard . '/view'] = array(
      'title' => 'View',
      'type' => MENU_DEFAULT_LOCAL_TASK,
      'weight' => -10,
    );
    return $items;
  }

  /**
   * Create the markup for the add Entityform Entities page within the class
   * so it can easily be extended/overriden.
   */
  public function addPage() {
    $item = menu_get_item();
    $content = system_admin_menu_block($item);
    if (count($content) == 1) {
      $item = array_shift($content);
      drupal_goto($item['href']);
    }
    return theme('entityform_add_list', array(
      'content' => $content,
    ));
  }
  public function confirm_path($bundle, $entityform_id = NULL) {
    module_load_include('inc', 'entityform', 'entityform_type.admin');
    $entityform_type = entityform_type_load($bundle);
    if (!empty($entityform_id)) {
      $redirect_path = $entityform_type
        ->get_redirect_path(entityform_load($entityform_id));
    }
    else {
      $redirect_path = $entityform_type
        ->get_redirect_path();
    }
    if (!empty($redirect_path)) {
      return $redirect_path;
    }
    $path = _entityform_type_get_confirm_url($bundle);
    $path = drupal_get_path_alias($path);
    if ($entityform_id) {
      return array(
        $path,
        array(
          'query' => array(
            'entityform_id' => $entityform_id,
          ),
        ),
      );
    }
    return array(
      $path,
    );
  }
  public function draft_path($bundle) {
    $bundle = str_replace('_', '-', $bundle);
    return "eform/{$bundle}/draft";
  }
  public function submit_path($bundle) {
    module_load_include('inc', 'entityform', 'entityform_type.admin');
    $path = _entityform_type_get_submit_url($bundle);
    $path = drupal_get_path_alias($path);
    return $path;
  }

}

Members

Namesort descending Modifiers Type Description Overrides
EntityDefaultUIController::$entityInfo protected property
EntityDefaultUIController::$entityType protected property
EntityDefaultUIController::$id_count protected property
EntityDefaultUIController::$overviewPagerLimit public property Defines the number of entries to show per page in overview table.
EntityDefaultUIController::applyOperation public function Applies an operation to the given entity.
EntityDefaultUIController::entityFormSubmitBuildEntity public function Entity submit builder invoked via entity_ui_form_submit_build_entity().
EntityDefaultUIController::hook_forms public function Provides definitions for implementing hook_forms().
EntityDefaultUIController::operationCount protected function Returns the operation count for calculating colspans.
EntityDefaultUIController::operationForm public function Builds the operation form.
EntityDefaultUIController::operationFormSubmit public function Operation form submit callback. 1
EntityDefaultUIController::operationFormValidate public function Operation form validation callback.
EntityDefaultUIController::overviewForm public function Builds the entity overview form.
EntityDefaultUIController::overviewFormSubmit public function Overview form submit callback.
EntityDefaultUIController::overviewFormValidate public function Overview form validation callback.
EntityDefaultUIController::overviewTable public function Generates the render array for a overview table for arbitrary entities matching the given conditions.
EntityDefaultUIController::overviewTableHeaders protected function Generates the table headers for the overview table.
EntityDefaultUIController::overviewTableRow protected function Generates the row for the passed entity and may be overridden in order to customize the rows.
EntityDefaultUIController::__construct public function
EntityformUIController::addPage public function Create the markup for the add Entityform Entities page within the class so it can easily be extended/overriden.
EntityformUIController::confirm_path public function
EntityformUIController::draft_path public function
EntityformUIController::hook_menu public function Overrides hook_menu() defaults. Main reason for doing this is that parent class hook_menu() is optimized for entity type administration. Overrides EntityDefaultUIController::hook_menu
EntityformUIController::submit_path public function