class FlexiformWebformUIController in Flexiform 7
UI Class
Hierarchy
- class \EntityDefaultUIController
- class \FlexiformWebformUIController
Expanded class hierarchy of FlexiformWebformUIController
1 string reference to 'FlexiformWebformUIController'
- flexiform_webform_entity_info in flexiform_webform/
flexiform_webform.module - Implements hook_entity_info().
File
- flexiform_webform/
flexiform_webform.admin.inc, line 10 - Model type editing UI.
View source
class FlexiformWebformUIController extends EntityDefaultUIController {
/**
* {@inheritdoc}
*/
public function hook_menu() {
$items = parent::hook_menu();
// Change the way they clone things.
$items['admin/structure/flexiform_webforms/manage/%entity_object/clone']['page callback'] = 'flexiform_webform_ui_get_clone_form';
return $items;
}
/**
* {@inheritdoc}
*/
public function operationCount() {
$count = parent::operationCount() + 1;
if (module_exists('panelizer')) {
$count++;
}
return $count;
}
/**
* {@inheritdoc}
*/
public function overviewForm($form, &$form_state, $conditions = array()) {
$collapsed = TRUE;
if (!empty($_GET['form_group'])) {
$conditions['form_group'] = $_GET['form_group'];
$collapsed = FALSE;
}
$form['filter'] = array(
'#type' => 'fieldset',
'#title' => t('Filter'),
'#collapsible' => TRUE,
'#collapsed' => $collapsed,
);
$form['filter']['#id'] = 'flexiform-filter-form';
$groups = flexiform_get_groups();
if (count($groups) > 0) {
$form['filter']['form_group'] = array(
'#title' => t('Filter by group'),
'#type' => 'select',
'#default_value' => !empty($conditions['form_group']) ? $conditions['form_group'] : 'general',
);
foreach ($groups as $group => $info) {
$form['filter']['form_group']['#options'][$group] = $info['label'];
}
}
$form['filter']['submit'] = array(
'#type' => 'submit',
'#value' => t('Filter'),
'#name' => '',
);
// Overridden to allow the passing of conditions through.
$form['table'] = $this
->overviewTable($conditions);
$form['pager'] = array(
'#theme' => 'pager',
);
$form['#method'] = 'get';
$form['#submit'][] = 'flexiform_form_submit_rebuild';
return $form;
}
/**
* Overrides overviewTable();
*/
public function overviewTable($conditions = array()) {
$entities = entity_load($this->entityType, FALSE, $conditions);
ksort($entities);
$rows = array();
foreach ($entities as $entity) {
$rows[] = $this
->overviewTableRow($conditions, entity_id($this->entityType, $entity), $entity);
}
$render = array(
'#theme' => 'table',
'#header' => $this
->overviewTableHeaders($conditions, $rows),
'#rows' => $rows,
'#empty' => t('None.'),
);
return $render;
}
/**
* {@inheritdoc}
*/
public function overviewTableRow($conditions, $id, $entity, $additional_cols = array()) {
$row = parent::overviewTableRow($conditions, $id, $entity, $additional_cols);
// We want to put 2 operations in the table before clone, export and revert.
$lastOperations = array_splice($row, -3, 3);
// Add the manage forms element.
$row[] = l(t('manage forms'), $this->path . '/manage/' . $id . '/forms');
if (module_exists('panelizer')) {
$row[] = l(t('panelizer'), 'admin/config/content/panelizer/flexiform_webform_submission/' . $id . '.default/content');
}
$row = array_merge($row, $lastOperations);
return $row;
}
}