m7v
3/28/2014 - 1:01 AM

Create page404/403 like Ctools CT plugin

Create page404/403 like Ctools CT plugin

<?php
/**
 * Callback function to supply a list of content types.
 */
function spaint_track_page404_ctools_content_types() {
  return array(
    'single'        => TRUE,
    'title'         => t('page404'),
    'description'   => t('page404 CTools CT'),
    'category'      => t('spaint_track'),
    'all contexts'  => TRUE,
    'defaults'      => array('mode' => 'full'),
    'hook theme' => 'page404_content_type_theme',
  );
}

/**
 * Implements hook_content_type_theme().
 */
function page404_content_type_theme(&$theme, $plugin) {
  $theme['page404'] = array(
    'path' => $plugin['path'],
    'template' => 'page404',
    'arguments' => array(
      'account' => NULL,
    ),
  );
}

/**
 * Output function for the content type
 */
function spaint_track_page404_content_type_render($subtype, $conf, $panel_args,  $contexts) {
  drupal_set_title(t('404 Not Found'));
  $block = new stdClass();
  $block->content = theme('page404');

  return $block;
}

function spaint_track_preprocess_page404(&$variables) {
  $buttom_to_main_page = l(
    t('Gallery'),
    'gallery',
    array(
      'attributes' => array(
        'class' => array(
          'button-back',
        )
      ),
    )
  );
  $variables['button_to_main_page'] = $buttom_to_main_page;
}