function ctools_access_ruleset_panels_dashboard_blocks

Implementation of hook_panels_dashboard_blocks().

Adds page information to the Panels dashboard.

File

ctools_access_ruleset/ctools_access_ruleset.module, line 44

Code

function ctools_access_ruleset_panels_dashboard_blocks(&$vars) {
    $vars['links']['ctools_access_ruleset'] = array(
        'title' => l(t('Custom ruleset'), 'admin/structure/ctools-rulesets/add'),
        'description' => t('Custom rulesets are combinations of access plugins you can use for access control, selection criteria and pane visibility.'),
    );
    // Load all mini panels and their displays.
    ctools_include('export');
    $items = ctools_export_crud_load_all('ctools_access_ruleset');
    $count = 0;
    $rows = array();
    foreach ($items as $item) {
        $rows[] = array(
            check_plain($item->admin_title),
            array(
                'data' => l(t('Edit'), "admin/structure/ctools-rulesets/list/{$item->name}/edit"),
                'class' => 'links',
            ),
        );
        // Only show 10.
        if (++$count >= 10) {
            break;
        }
    }
    if ($rows) {
        $content = theme('table', array(
            'rows' => $rows,
            'attributes' => array(
                'class' => 'panels-manage',
            ),
        ));
    }
    else {
        $content = '<p>' . t('There are no custom rulesets.') . '</p>';
    }
    $vars['blocks']['ctools_access_ruleset'] = array(
        'title' => t('Manage custom rulesets'),
        'link' => l(t('Go to list'), 'admin/structure/ctools-rulesets'),
        'content' => $content,
        'class' => 'dashboard-ruleset',
        'section' => 'right',
    );
}