You are here

function ccl_blocks_ccl_link_info in Custom Contextual Links 7

Same name and namespace in other branches
  1. 8 ccl_blocks/ccl_blocks.module \ccl_blocks_ccl_link_info()

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

File

ccl_blocks/ccl_blocks.module, line 187
Implments support for CCL on blocks.

Code

function ccl_blocks_ccl_link_info($record) {
  if ($record->type == 'block') {
    $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['block_global']) {
      $options_return['desc'] = t('Attached to all blocks.');
    }
    else {
      $blocks = _ccl_blocks_get_info();
      $options_return['desc'] = format_plural(count($options['block_select']), 'Attached to block: %block', 'Attached to blocks: %block', array(
        '%block' => implode(', ', array_intersect_key($blocks, $options['block_select'])),
      ));
    }
    return $options_return;
  }
  else {
    return "";
  }
}