class SendinBlueSignupUIController in SendinBlue 7
Same name and namespace in other branches
- 7.2 includes/sendinblue_signup.ui_controller.inc \SendinBlueSignupUIController
Override EntityDefaultUIController to customize our menu items.
Hierarchy
- class \EntityDefaultUIController
- class \SendinBlueSignupUIController
Expanded class hierarchy of SendinBlueSignupUIController
1 string reference to 'SendinBlueSignupUIController'
- sendinblue_entity_info in ./
sendinblue.module - Implements hook_entity_info().
File
- includes/
sendinblue_signup.ui_controller.inc, line 10 - Class file for SendinBlue Signup UI Controller.
View source
class SendinBlueSignupUIController extends EntityDefaultUIController {
/**
* Overrides parent::hook_menu().
*/
public function hook_menu() {
$items = parent::hook_menu();
$items[$this->path]['title'] = t('Signup Forms');
$items[$this->path]['description'] = t('Manage SendinBlue Signup blocks and pages.');
$items[$this->path]['type'] = MENU_LOCAL_TASK;
$items[$this->path]['weight'] = 10;
$items[$this->path]['access callback'] = 'sendinblue_signup_entity_access';
return $items;
}
/**
* Overrides parent::overviewTable().
*/
public function overviewTable($conditions = array()) {
$render = parent::overviewTable($conditions);
foreach ($render['#rows'] as &$row) {
$signup = $row[0]['data']['#url']['options']['entity'];
$modes = NULL;
$block_only = FALSE;
switch ($signup->mode) {
case SENDINBLUE_SIGNUP_BLOCK:
$modes = l(t('Block'), 'admin/structure/block');
$block_only = TRUE;
break;
case SENDINBLUE_SIGNUP_PAGE:
$modes = l(t('Page'), $signup->settings['path']);
break;
case SENDINBLUE_SIGNUP_BOTH:
$modes = l(t('Block'), 'admin/structure/block') . ' and ' . l(t('Page'), $signup->settings['path']);
break;
}
$list_labels = array();
$list_name = SendinblueManager::getListNameById($signup->settings['subscription']['settings']['list']);
$list_labels[] = l($list_name, 'https://my.sendinblue.com/users/list/id/?utm_source=drupal_plugin&utm_medium=plugin&utm_campaign=module_link' . $signup->settings['subscription']['settings']['list']);
if ($block_only) {
$access = t('N/A - this form only exists as a block');
}
else {
$all_roles_allowed = user_roles(FALSE, 'sendinblue_signup_all_forms' . $signup->name);
$page_roles_allowed = user_roles(FALSE, 'sendinblue_signup_form_' . $signup->name);
$roles_allowed = array_merge($all_roles_allowed, $page_roles_allowed);
$access = implode(', ', $roles_allowed);
$actions[] = l(t('Permissions'), 'admin/people/permissions', array(
'fragment' => 'edit-sendinblue-signup-all-forms',
));
}
$new_row = array();
// Put the label column data first:
$new_row[] = array_shift($row);
// Now our custom columns:
$new_row[] = $modes;
$new_row[] = implode(', ', $list_labels);
$new_row[] = $access;
// Now tack on the remaining built-in rows:
$row = array_merge($new_row, $row);
}
$new_header[] = array_shift($render['#header']);
$new_header[] = t('Display Mode(s)');
$new_header[] = t('SendinBlue Lists');
$new_header[] = t('Page Access');
$render['#header'] = array_merge($new_header, $render['#header']);
return $render;
}
}