function cck_default_value_php in Content Construction Kit (CCK) 7.3
Callback to return default value constructed from php code snippet.
3 string references to 'cck_default_value_php'
- cck_content_migrate_instance_alter in ./
cck.module - Implements hook_content_migrate_instance_alter().
- cck_default_value_form in ./
cck.module - Add fields to default value form to allow users to input a function or a PHP snippet that will return the default values.
- cck_default_value_validate in ./
cck.module - Validation handler to store php default values.
File
- ./
cck.module, line 286 - Allows administrators to use php code snippets to define allowed values or default values. The snippets are stored in a database table and retrieved in callback functions.
Code
function cck_default_value_php($entity_type, $entity, $field, $instance, $langcode = LANGUAGE_NONE) {
$default_value = array();
ob_start();
$result = eval(cck_field_get_setting('default_value_php', 'instance', $field, $instance, $langcode, $flatten = TRUE));
ob_end_clean();
if (is_array($result)) {
$default_value = $result;
}
return $default_value;
}