You are here

function fasttoggle_block_link_register in Fasttoggle 7

Return the list of links after adding a new entry if provided.

Parameters

mixed $link: The link.

string $group: The group to which the link belongs.

string $key: The key within the group.

string $instance: The instance of the key.

Return value

array The list of links so far, grouped by group and key.

2 calls to fasttoggle_block_link_register()
fasttoggle_block_view in ./fasttoggle.module
Implements hook_block_view().
fasttoggle_node_node_view in module/fasttoggle_node/fasttoggle_node.module
Implements hook_node_view_alter().

File

./fasttoggle.module, line 779
Enables fast toggling of binary or not so binary settings.

Code

function fasttoggle_block_link_register($link = NULL, $group = NULL, $key = NULL, $instance = NULL) {
  static $links = array();
  if (!is_null($link)) {

    // Avoid duplicates by keying by the content.
    if (is_null($group)) {
      $group = '';
    }
    if (is_null($key)) {
      $key = '';
    }
    if (is_null($instance)) {
      $instance = '';
    }
    if (!isset($links[$group])) {
      $links[$group] = array();
    }
    if (!isset($links[$key])) {
      $links[$key] = array();
    }
    $links[$group][$key][$instance] = $link;
  }
  return $links;
}