function oa_widgets_add_content_render in Open Atrium Core 7.2
Run-time rendering of the body of the block (content type) See ctools_plugin_examples for more advanced info
1 string reference to 'oa_widgets_add_content_render'
- oa_widgets_add_content.inc in modules/
oa_widgets/ plugins/ content_types/ oa_widgets_add_content.inc
File
- modules/
oa_widgets/ plugins/ content_types/ oa_widgets_add_content.inc, line 28
Code
function oa_widgets_add_content_render($subtype, $conf, $args, $context = NULL) {
$nodes = $conf['oa_widgets_types'];
$class = !empty($conf['button_class']) ? $conf['button_class'] : '';
if (strpos($class, 'btn') !== FALSE) {
if (strpos($class, 'btn-') === FALSE) {
// handle default buttons in bootstrap 3
$class .= ' btn-default';
}
}
$prefix = !empty($conf['title_prefix']) ? $conf['title_prefix'] : '';
$links = array();
foreach ($nodes as $node_type) {
$node = node_type_load($node_type);
if (is_object($node) && node_access('create', $node_type)) {
$links[] = '<li>' . l($prefix . $node->name, 'node/add/' . str_replace('_', '-', $node_type), array(
'attributes' => array(
'class' => $class,
),
)) . '</li>';
}
}
$output = '<ul>' . implode($links) . '</ul>';
$block = new stdClass();
$block->title = t('Create content');
$block->content = $output;
if (!empty($links)) {
return $block;
}
return FALSE;
}