diff --git a/includes/tripal_hq_admin_dashboard.form.inc b/includes/tripal_hq_admin_dashboard.form.inc
index 388d20f..09f8e03 100644
--- a/includes/tripal_hq_admin_dashboard.form.inc
+++ b/includes/tripal_hq_admin_dashboard.form.inc
@@ -32,6 +32,8 @@ function tripal_hq_admin_dashboard_form(array $form, array &$form_state, $status
global $user;
$uid = $user->uid;
+ $items_per_page = 10;
+
$form['instructions'] = ['#markup' => $message];
$header = [
@@ -80,7 +82,7 @@ function tripal_hq_admin_dashboard_form(array $form, array &$form_state, $status
$requests = $query->fields('t')
->orderBy('id', 'desc')
- ->limit(10)
+ ->limit($items_per_page)
->execute()
->fetchAll();
}
@@ -95,20 +97,11 @@ function tripal_hq_admin_dashboard_form(array $form, array &$form_state, $status
}
$requests = $query->fields('t')
->orderBy('id', 'desc')
- ->limit(10)
+ ->limit($items_per_page)
->execute()
->fetchAll();
}
- if (!$requests) {
- $message = '
no ' . $status . ' requests
';
-
- $form['message'] = [
- '#markup' => $message,
- ];
- return $form;
- }
-
$rows = [];
$date_format = 'M d Y H:i:s';
@@ -144,14 +137,23 @@ function tripal_hq_admin_dashboard_form(array $form, array &$form_state, $status
$rows[] = $row;
}
- $output = theme('table', [
- 'header' => $header,
- 'rows' => $rows,
- ]);
+ $form['table'] = [
+ '#theme' => 'table',
+ '#header' => $header,
+ '#rows' => $rows,
+ '#empty' => t('There are no !status content submissions.', ['!status' => $status]),
+ ];
+
+ $form['pager'] = [
+ '#theme' => 'pager',
+ ];
- $output .= theme('pager', ['quantity', 5]);
+ // Now we add in an alter hook to allow submodules to add to this dashboard.
+ // To use this after hook in your own module create a function named
+ // [yourmodule]_tripal_hq_admin_dashboard_alter($form, $form_state, $status)
+ // and change or add to the form as needed.
+ drupal_alter('tripal_hq_admin_dashboard', $form, $form_state, $status);
- $form['table'] = ['#markup' => $output];
return $form;
}
diff --git a/includes/tripal_hq_user_dashboard.form.inc b/includes/tripal_hq_user_dashboard.form.inc
index 557695c..7035725 100644
--- a/includes/tripal_hq_user_dashboard.form.inc
+++ b/includes/tripal_hq_user_dashboard.form.inc
@@ -16,6 +16,8 @@ function tripal_hq_user_dashboard_form($form, &$form_state) {
global $user;
$uid = $user->uid;
+ $items_per_page = 5;
+
$header = [
'Title' => [
'data' => t('Title'),
@@ -45,7 +47,7 @@ function tripal_hq_user_dashboard_form($form, &$form_state) {
->extend('TableSort')
->orderByHeader($header)
->extend('PagerDefault')
- ->limit(20)
+ ->limit($items_per_page)
->execute()
->fetchAll();
@@ -101,13 +103,22 @@ function tripal_hq_user_dashboard_form($form, &$form_state) {
];
}
- $output = theme(
- 'table', [
- 'header' => $header,
- 'rows' => $rows,
- ]
- );
+ $form['my_submissions'] = [
+ '#theme' => 'table',
+ '#header' => $header,
+ '#rows' => $rows,
+ '#empty' => t("You have no pending content submissions."),
+ ];
+
+ $form['pager'] = [
+ '#theme' => 'pager',
+ ];
+
+ // Now we add in an alter hook to allow submodules to add to this dashboard.
+ // To use this after hook in your own module create a function named
+ // [yourmodule]_tripal_hq_user_dashboard_alter($form, $form_state) {}
+ // and change or add to the form as needed.
+ drupal_alter('tripal_hq_user_dashboard', $form, $form_state);
- $form['my_submissions'] = ['#markup' => $output];
return $form;
}