function panels_content_custom_php in Panels 5.2
Same name and namespace in other branches
- 6.2 content_types/custom_php.inc \panels_content_custom_php()
Output function for the 'custom_php' content type. Allows sufficiently privileged users to enter custom php code that is evaluated while $context is in scope. Use with caution!
1 string reference to 'panels_content_custom_php'
- panels_custom_php_panels_content_types in content_types/
custom_php.inc - Callback function to supply a list of content types.
File
- content_types/
custom_php.inc, line 28
Code
function panels_content_custom_php($conf, $panel_args, $context) {
static $delta = 0;
$block = new stdClass();
// eval() the php that has been entered by the user.
eval($conf['body']);
$block->delta = ++$delta;
// Put our default member values into a separate array.
$members = array(
'module' => 'custom',
'subject' => filter_xss_admin($conf['title']),
'content' => '',
);
// Iterate through the array of defaults and assign put in
// any values that haven't already been set by the custom
// php code.
foreach ($members as $member => $value) {
if (empty($block->{$member})) {
$block->{$member} = $value;
}
}
return $block;
}