array(
'name' => t('PHP code'),
'description' => t('Validates if the evaluated PHP code returns TRUE
(PHP-mode, experts only).'),
),
);
}
function condition_php_requirement_form($context) {
$form['php_code'] = array(
'#type' => 'textarea',
'#title' => t('PHP Code'),
'#description' => t('Enter PHP code between <?php ?>. Note that executing incorrect PHP-code can break your Drupal site.'),
'#default_value' => $context['code'],
);
return $form;
}
function condition_php_requirement_form_submit($form, &$form_state) {
if ($form_state['values']['php_code']) {
return array('code' => $form_state['values']['php_code']);
}
}
function condition_php_requirement(&$condition, $context = array()) {
return (!$context['code'] || drupal_eval($context['code']));
}
?>