You are here

function flag_node_operations in Flag 5

Same name and namespace in other branches
  1. 6.2 flag.module \flag_node_operations()
  2. 6 flag.module \flag_node_operations()
  3. 7.3 flag.module \flag_node_operations()
  4. 7.2 flag.module \flag_node_operations()

Implementation of hook_node_operations().

Add additional options on the admin/build/node page.

File

./flag.module, line 553
The Flag module.

Code

function flag_node_operations() {
  global $user;
  $flags = flag_get_flags('node', NULL, $user);
  $operations = array();
  foreach ($flags as $flag) {
    $operations['flag_' . $flag->name] = array(
      'label' => $flag
        ->get_label('flag_short'),
      'callback' => 'flag_nodes',
      'callback arguments' => array(
        'flag',
        $flag->name,
      ),
      'behavior' => array(),
    );
    $operations['unflag_' . $flag->name] = array(
      'label' => $flag
        ->get_label('unflag_short'),
      'callback' => 'flag_nodes',
      'callback arguments' => array(
        'unflag',
        $flag->name,
      ),
      'behavior' => array(),
    );
  }
  return $operations;
}