function formassembly_build_list in FormAssembly 7
Callback for the formassembly overview page.
1 string reference to 'formassembly_build_list'
- formassembly_menu in ./
formassembly.module - Implements hook_menu().
File
- ./
formassembly.admin.inc, line 175 - Contains FormAssembly admin settings.
Code
function formassembly_build_list() {
$rows = array();
// Build the sortable table header.
$header = array(
'title' => array(
'data' => 'Title',
'type' => 'property',
'specifier' => 'name',
'sort' => 'asc',
),
'operations' => array(
'data' => t('Operations'),
),
);
$query = new EntityFieldQuery();
$query
->entityCondition('entity_type', 'fa_form')
->tableSort($header)
->pager(50);
$result = $query
->execute();
if (!empty($result)) {
$forms = formassembly_load_multiple(array_keys($result['fa_form']));
}
else {
$forms = array();
}
foreach ($forms as $form) {
$rows[$form->eid] = array(
'title' => array(
'data' => array(
'#type' => 'link',
'#title' => $form->name,
'#href' => 'formassembly/' . $form->eid,
),
),
);
$destination = drupal_get_destination();
// Build a list of all the accessible operations for the current form.
$operations = array();
if (entity_access('edit', 'fa_form', $form)) {
$operations['edit'] = array(
'title' => t('Edit Parameters'),
'href' => 'formassembly/' . $form->eid . '/edit',
'query' => $destination,
);
}
// Render an unordered list of operations links.
$rows[$form->eid]['operations'] = array(
'data' => array(
'#theme' => 'links__fa_form_operations',
'#links' => $operations,
'#attributes' => array(
'class' => array(
'links',
'inline',
),
),
),
);
}
$output = array(
'fa_form_content' => array(
'#theme' => 'table',
'#header' => $header,
'#rows' => $rows,
'#empty' => t('There are no FormAssembly forms available.'),
),
'pager' => array(
'#theme' => 'pager',
),
);
return $output;
}