Trouble with implementing contextual links
After one day of research I got a solution:

$build[1] = array(
    '#theme' =&gt; 'filteredusers_object',
    '#object' =&gt; $object,
    '#contextual_links' =&gt; array(array('', array())), // replaced by dummy data
    '#marker' =&gt; 'marker',
);


And adding this new hook:

function filteredusers_contextual_links_view_alter(&amp;$element, &amp;$items) {
    if(isset($element['#element']['#marker']) &amp;&amp; 
             $element['#element']['#marker'] == "marker") {
        $element['#links']['custom-link'] = array(
            'title' =&gt; 'Some title',
            'href' =&gt; url('node/42', array('absolute' =&gt; TRUE)),
        );
    }
}