custom.inc
Go to the documentation of this file.00001 <?php
00002
00003
00004
00005
00006
00007
00008 function panels_custom_panels_content_types() {
00009 $items['custom'] = array(
00010 'title' => t('Custom'),
00011 'weight' => -10,
00012 'single' => TRUE,
00013 'content_types' => 'panels_admin_content_types_custom',
00014 'render callback' => 'panels_content_custom',
00015 'editor render callback' => 'panels_admin_content_custom',
00016 'add callback' => 'panels_admin_edit_custom',
00017 'edit callback' => 'panels_admin_edit_custom',
00018 'title callback' => 'panels_admin_title_custom',
00019 'no override title' => TRUE,
00020 );
00021 return $items;
00022 }
00023
00024
00025
00026
00027
00028 function panels_content_custom($conf) {
00029 static $delta = 0;
00030
00031 $block = new stdClass();
00032 $block->module = 'custom';
00033 $block->delta = ++$delta;
00034 $block->subject = filter_xss_admin($conf['title']);
00035 $block->content = check_markup($conf['body'], $conf['format'], FALSE);
00036
00037 return $block;
00038 }
00039
00040
00041
00042
00043
00044
00045
00046
00047
00048 function panels_admin_content_custom($display, $pane) {
00049 $block = new stdClass();
00050 $block->title = filter_xss_admin($pane->configuration['title']);
00051
00052
00053
00054
00055 $php_filter = FALSE;
00056 foreach (filter_list_format($pane->configuration['format']) as $filter) {
00057 if ($filter->name == 'PHP evaluator') {
00058 $php_filter = TRUE;
00059 }
00060 }
00061
00062 $block->content = check_markup($pane->configuration['body'], $php_filter ? 1 : $pane->configuration['format']);
00063 return $block;
00064 }
00065
00066
00067
00068
00069 function panels_admin_content_types_custom() {
00070 return array(
00071 'custom' => array(
00072 'title' => t('New custom content'),
00073 'icon' => 'icon_block_custom.png',
00074 'path' => panels_get_path('content_types/custom'),
00075 'description' => t('Create a completely custom piece of HTML content.'),
00076 'category' => array(t('Custom'), -10),
00077 ),
00078 );
00079 }
00080
00081
00082
00083
00084 function panels_admin_edit_custom($id, $parents, $conf = NULL) {
00085 if (!is_array($conf)) {
00086 $conf = array('title' => '', 'body' => '');
00087 }
00088 $form['title'] = array(
00089 '#type' => 'textfield',
00090 '#default_value' => $conf['title'],
00091 '#title' => t('Title'),
00092 );
00093 $form['body'] = array(
00094 '#title' => t('Body'),
00095 '#type' => 'textarea',
00096 '#default_value' => $conf['body'],
00097 );
00098 $parents[] = 'format';
00099 $form['format'] = filter_form($conf['format'], 1, $parents);
00100
00101 return $form;
00102 }
00103
00104
00105
00106
00107 function panels_admin_title_custom($conf) {
00108 $output = t('Custom');
00109 if ($conf['title']) {
00110 $output .= " (" . filter_xss_admin($conf['title']) . ")";
00111 }
00112 return $output;
00113 }
00114