t('CTools example relcontext content type'),
'admin info' => 'ctools_plugin_example_relcontext_content_type_admin_info',
'content_types' => 'relcontext_content_type',
'single' => TRUE,
'render callback' => 'relcontext_content_type_render',
// Icon goes in the directory with the content type. Here, in plugins/content_types.
'icon' => 'icon_example.png',
'description' => t('Relcontext content type - works with relcontext context.'),
'required context' => new ctools_context_required(t('Relcontext'), 'relcontext'),
'category' => array(t('CTools Examples'), -9),
'edit form' => 'relcontext_edit_form',
// this example does not provide 'admin info', which would populate the
// panels builder page preview.
);
/**
* Run-time rendering of the body of the blcok
*
* @param $subtype
* @param $conf
* Configuration as done at admin time
* @param $args
* @param $context
* Context - in this case we don't have any
*
* @return
* An object with at least title and content members
*/
function relcontext_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 = "Relcontext content type";
$block->content = t("
This is a block of data created by the Relcontent content type.
Data in the block may be assembled from static text (like this) or from the
content type settings form (\$conf) for the content type, or from the context
that is passed in.
In our case, the configuration form (\$conf) has just one field, 'config_item_1;
and it's configured with:
");
if (!empty($conf)) {
$block->content .= '