function cck_allowed_values_php in Content Construction Kit (CCK) 7.3
Callback to return allowed values constructed from php code snippet.
3 string references to 'cck_allowed_values_php'
- cck_allowed_values_form in ./
cck.module - Add fields to allowed values form to allow users to input a function or a PHP snippet that will return the allowed values.
- cck_allowed_values_validate in ./
cck.module - Validation handler to store php allowed values.
- cck_content_migrate_field_alter in ./
cck.module - Implements hook_content_migrate_field_alter().
File
- ./
cck.module, line 301 - 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_allowed_values_php($field, $flatten = TRUE) {
$allowed_values = array();
ob_start();
$result = eval(cck_field_get_setting('allowed_values_php', 'field', $field));
ob_end_clean();
if (is_array($result)) {
if ($flatten) {
$result = cck_array_flatten($result);
}
$allowed_values = $result;
}
return $allowed_values;
}