Révision 3753f249
Ajouté par Assos Assos il y a plus de 10 ans
htmltest/sites/all/modules/ctools/plugins/content_types/entity_context/entity_field.inc | ||
---|---|---|
38 | 38 |
$context_types = array(); |
39 | 39 |
$entities = entity_get_info(); |
40 | 40 |
|
41 |
$description = t('Field on the referenced entity.'); |
|
42 |
$styles = t('Formatter Styles'); |
|
43 |
$categories = array(); |
|
41 | 44 |
foreach ($entities as $entity_type => $entity) { |
45 |
$category = t(ucfirst($entity_type)); |
|
46 |
$categories[$entity_type] = $category; |
|
42 | 47 |
foreach ($entity['bundles'] as $type => $bundle) { |
43 | 48 |
foreach (field_info_instances($entity_type, $type) as $field_name => $field) { |
44 | 49 |
if (!isset($types[$entity_type . ':' . $field_name])) { |
50 |
$label = t($field['label']); |
|
45 | 51 |
$types[$entity_type . ':' . $field_name] = array( |
46 |
'category' => t(ucfirst($entity_type)),
|
|
52 |
'category' => $category,
|
|
47 | 53 |
'icon' => 'icon_field.png', |
48 | 54 |
'title' => t('Field: @widget_label (@field_name)', array( |
49 |
'@widget_label' => t($field['label']),
|
|
55 |
'@widget_label' => $label,
|
|
50 | 56 |
'@field_name' => $field_name, |
51 | 57 |
)), |
52 |
'description' => t('Field on the referenced entity.'),
|
|
58 |
'description' => $description,
|
|
53 | 59 |
'edit form' => array( |
54 | 60 |
'ctools_entity_field_content_type_formatter_options' => array( |
55 | 61 |
'default' => TRUE, |
56 | 62 |
'title' => t('Formatter options for: @widget_label (@field_name)', array( |
57 |
'@widget_label' => t($field['label']),
|
|
63 |
'@widget_label' => $label,
|
|
58 | 64 |
'@field_name' => $field_name, |
59 | 65 |
)), |
60 | 66 |
), |
61 |
'ctools_entity_field_content_type_formatter_styles' => t('Formatter Styles'),
|
|
67 |
'ctools_entity_field_content_type_formatter_styles' => $styles,
|
|
62 | 68 |
), |
63 | 69 |
); |
64 | 70 |
} |
... | ... | |
70 | 76 |
// Create the required context for each field related to the bundle types. |
71 | 77 |
foreach ($types as $key => $field_content_type) { |
72 | 78 |
list($entity_type, $field_name) = explode(':', $key, 2); |
73 |
$types[$key]['required context'] = new ctools_context_required(t(ucfirst($entity_type)), $entity_type, array(
|
|
79 |
$types[$key]['required context'] = new ctools_context_required($categories[$entity_type], $entity_type, array(
|
|
74 | 80 |
'type' => array_keys($context_types[$key]['types']), |
75 | 81 |
)); |
76 | 82 |
unset($context_types[$key]['types']); |
Formats disponibles : Unified diff
Weekly update of contrib modules