function _token_example_get_node

Same name in other branches
  1. 7.x-1.x token_example/token_example.module \_token_example_get_node()

Build a list of available content.

Related topics

File

token_example/token_example.module, line 161

Code

function _token_example_get_node() {
    if (!user_access('access content') && !user_access('administer nodes')) {
        return array();
    }
    $sql = "SELECT n.nid, n.title FROM {node} n WHERE n.status = %d ORDER BY n.created DESC";
    $query = db_query_range(db_rewrite_sql($sql), 1, 0, 10);
    $nodes = array();
    while ($result = db_fetch_object($query)) {
        $nodes[$result->nid] = $result->title;
    }
    $nodes = array_map('check_plain', $nodes);
    return $nodes;
}