function opigno_get_tool in Opigno 7
Fetch information for a specific tool. Optionally, can be filtered by access rights.
Parameters
string $name:
stdClass $node = NULL:
stdClass $account = NULL:
Return value
array|false
2 calls to opigno_get_tool()
- opigno_field_formatter_view in ./
opigno.module - Implements hook_field_formatter_view().
- opigno_get_node_tools in ./
opigno.module - Get tools for the node. Optionally filter by access permissions.
File
- ./
opigno.module, line 436 - Contains all hook_implementations and module specific API.
Code
function opigno_get_tool($name, $node = NULL, $account = NULL) {
// Add defaults to prevent Notices.
$defaults = array(
'machine_name' => $name,
'description' => '',
'path' => '',
'actions' => array(),
'access_arguments' => array(
'access content',
),
'access_callback' => 'user_access',
'weight' => 0,
);
$tools = opigno_get_tools($node);
if (isset($tools[$name])) {
$tool = $tools[$name] + $defaults;
// If an account was given, check user access.
if (isset($account)) {
if (!opigno_tool_access($tool, $account)) {
return FALSE;
}
}
return $tool;
}
return FALSE;
}