function simplecontext_content_type_render
Run-time rendering of the body of the block (content type)
Parameters
$subtype:
$conf: Configuration as done at admin time
$args:
$context: Context - in this case we don't have any
Return value
An object with at least title and content members
1 call to simplecontext_content_type_render()
- ctools_plugin_example_simplecontext_content_type_admin_info in ctools_plugin_example/
plugins/ content_types/ simplecontext_content_type.inc - Callback to provide administrative info (the preview in panels when building a panel).
1 string reference to 'simplecontext_content_type_render'
- simplecontext_content_type.inc in ctools_plugin_example/
plugins/ content_types/ simplecontext_content_type.inc - Sample ctools content type that takes advantage of context.
File
-
ctools_plugin_example/
plugins/ content_types/ simplecontext_content_type.inc, line 74
Code
function simplecontext_content_type_render($subtype, $conf, $args, $context) {
$data = $context->data;
$block = new stdClass();
// Don't forget to check this data if it's untrusted.
// The title actually used in rendering.
$block->title = "Simplecontext content type";
$block->content = t("\n This is a block of data created by the Simplecontext content type.\n Data in the block may be assembled from static text (like this) or from the\n content type settings form (\$conf) for the content type, or from the context\n that is passed in. <br />\n In our case, the configuration form (\$conf) has just one field, 'config_item_1;\n and it's configured with:\n ");
if (!empty($conf)) {
$block->content .= '<div style="border: 1px solid red;">' . print_r(filter_xss_admin($conf['config_item_1']), TRUE) . '</div>';
}
if (!empty($context)) {
$block->content .= '<br />The args ($args) were <div style="border: 1px solid yellow;" >' . var_export($args, TRUE) . '</div>';
}
$block->content .= '<br />And the simplecontext context ($context->data->description) was <div style="border: 1px solid green;" >' . print_r($context->data->description, TRUE) . '</div>';
return $block;
}