You are here

function node_convert_return_access_node_types in Node Convert 7

Same name and namespace in other branches
  1. 6 node_convert.module \node_convert_return_access_node_types()

Returns a list of node types that the user has access to, depending on the direction of conversion.

Parameters

$direction: A string containing either 'to' or 'from'.

Return value

An array of node types or FALSE if the user doesn't have access to any node type.

2 calls to node_convert_return_access_node_types()
node_convert_add_template in ./node_convert.admin.inc
Add template page callback.
node_convert_conversion_form in ./node_convert.forms.inc
Node conversion form.

File

./node_convert.module, line 328

Code

function node_convert_return_access_node_types($direction) {
  $list = array();
  $types = node_type_get_types();
  foreach ($types as $type => $parameters) {
    if (user_access('administer conversion') || user_access('convert ' . $direction . ' ' . $type)) {
      $list[$type] = $parameters->name;
    }
  }
  if (!empty($list)) {
    return $list;
  }
  else {
    return FALSE;
  }
}