You are here

function ccl_views_ccl_link_info in Custom Contextual Links 8

Same name and namespace in other branches
  1. 7 ccl_views/ccl_views.module \ccl_views_ccl_link_info()

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

File

ccl_views/ccl_views.module, line 224
Implements support of views in CCL.

Code

function ccl_views_ccl_link_info($record) {
  if ($record->type == 'view') {

    // @FIXME
    // l() expects a Url object, created from a route name or external URI.
    // $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['view_options'] == 0) {
      $options_return['desc'] = t('Attached to all views.');
    }
    elseif ($options['view_options'] == 1) {
      $views = _ccl_views_get_info();
      $options_return['desc'] = t('Attached to the %view view.', array(
        '%view' => $views['views'][$options['view_view']],
      ));
    }
    elseif ($options['view_options'] == 2) {
      $views = _ccl_views_get_info();
      $options_return['desc'] = t('Attached to the %view view display.', array(
        '%view' => $views['displays'][$options['view_display']],
      ));
    }
    return $options_return;
  }
  else {
    return "";
  }
}