You are here

function ccl_local_actions_ccl_link_info in Custom Contextual Links 7

Same name and namespace in other branches
  1. 8 ccl_local_actions/ccl_local_actions.module \ccl_local_actions_ccl_link_info()

Hook function to provide link option information for the link list page.

File

ccl_local_actions/ccl_local_actions.module, line 237
Adds the ability to create local tasks with CCL.

Code

function ccl_local_actions_ccl_link_info($record) {
  if ($record->type == 'local_actions') {
    $options_return = array(
      'desc' => '',
      'op' => l(t('Edit'), 'admin/config/user-interface/ccl/' . $record->clid . '/edit') . ' | ' . l(t('Delete'), 'admin/config/user-interface/ccl/' . $record->clid . '/delete'),
    );
    $options = unserialize($record->options);
    if ($options['la_visibility']) {
      $options_return['desc'] = t('Only displayed on specific pages.');
    }
    else {
      $options_return['desc'] = t('Displayed on all pages with exceptions.');
    }
    $clean = array_filter($options['la_types']);
    if (!empty($clean)) {
      $options_return['desc'] .= ' ' . t('Limited by content type.');
    }
    $clean = array_filter($options['la_roles']);
    if (!empty($clean)) {
      $options_return['desc'] .= ' ' . t('Limited by user roles.');
    }
    return $options_return;
  }
  else {
    return "";
  }
}