Skip to content

Instantly share code, notes, and snippets.

@m7v
Created March 28, 2014 01:01
Show Gist options
  • Save m7v/9822784 to your computer and use it in GitHub Desktop.
Save m7v/9822784 to your computer and use it in GitHub Desktop.
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;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment