function ctools_entity_field_value_ctools_access_settings
Settings form for the 'by entity_bundle' access plugin.
1 string reference to 'ctools_entity_field_value_ctools_access_settings'
- entity_field_value.inc in plugins/
access/ entity_field_value.inc
File
-
plugins/
access/ entity_field_value.inc, line 80
Code
function ctools_entity_field_value_ctools_access_settings($form, &$form_state, $conf) {
$plugin = $form_state['plugin'];
list($parent, $entity_type, $bundle_type, $field_name) = explode(':', $plugin['name']);
$entity_info = entity_get_info($entity_type);
$instances = field_info_instances($entity_type, $bundle_type);
$instance = $instances[$field_name];
$field = field_info_field_by_id($instance['field_id']);
foreach ($field['columns'] as $column => $attributes) {
$columns[$column] = _field_sql_storage_columnname($field_name, $column);
}
ctools_include('fields');
$entity = (object) array(
$entity_info['entity keys']['bundle'] => $bundle_type,
);
foreach ($columns as $column => $sql_column) {
if (isset($conf[$sql_column])) {
if (is_array($conf[$sql_column])) {
foreach ($conf[$sql_column] as $delta => $conf_value) {
if (is_numeric($delta)) {
if (is_array($conf_value)) {
$entity->{$field_name}[LANGUAGE_NONE][$delta][$column] = $conf_value[$column];
}
else {
$entity->{$field_name}[LANGUAGE_NONE][$delta][$column] = $conf_value;
}
}
}
}
else {
$entity->{$field_name}[LANGUAGE_NONE][0][$column] = $conf[$sql_column];
}
}
}
$form['#parents'] = array(
'settings',
);
$langcode = field_valid_language(NULL);
$form['settings'] += (array) ctools_field_invoke_field($instance, 'form', $entity_type, $entity, $form, $form_state, array(
'default' => TRUE,
'language' => $langcode,
));
// Weight is really not important once this is populated and will only interfere with the form layout.
foreach (element_children($form['settings']) as $element) {
unset($form['settings'][$element]['#weight']);
}
return $form;
}