views_empty.inc

File

views_content/plugins/content_types/views_empty.inc

View source
<?php


/**
 * @file
 * Allow a view context to display its attachment(s).
 */
$plugin = array(
    'title' => t('View empty text'),
    'category' => t('View context'),
    'icon' => 'icon_views_page.png',
    'description' => t('Display the view empty text if there are no results.'),
    'required context' => new ctools_context_required(t('View'), 'view'),
);

/**
 * Render the node_terms content type.
 */
function views_content_views_empty_content_type_render($subtype, $conf, $panel_args, $context) {
    if (empty($context) || empty($context->data)) {
        return;
    }
    // Build the content type block.
    $block = new stdClass();
    $block->module = 'views_empty';
    $block->delta = $context->argument;
    $block->title = '';
    $block->content = '';
    $output = views_content_context_get_output($context);
    if (isset($output['empty'])) {
        $block->content = $output['empty'];
    }
    return $block;
}
function views_content_views_empty_content_type_edit_form($form, &$form_state) {
    // This form does nothing; it exists to let the main form select the view context.
    return $form;
}
function views_content_views_empty_content_type_edit_form_submit(&$form, &$form_state) {
    // Kept so we guarantee we have a submit handler.
}

/**
 * Returns the administrative title for a type.
 */
function views_content_views_empty_content_type_admin_title($subtype, $conf, $context) {
    return t('"@context" empty text', array(
        '@context' => $context->identifier,
    ));
}

Functions