fixed the create materials bugs from materio_id module
This commit is contained in:
parent
1fcf130b96
commit
12c77de231
|
@ -1,10 +0,0 @@
|
||||||
page_alter: false
|
|
||||||
raw_names: false
|
|
||||||
error_handlers:
|
|
||||||
1: 1
|
|
||||||
rebuild_theme: false
|
|
||||||
debug_mail_file_format: '%to-%subject-%datetime.mail.txt'
|
|
||||||
debug_mail_directory: 'temporary://devel-mails'
|
|
||||||
devel_dumper: kint
|
|
||||||
debug_logfile: 'temporary://drupal_debug.txt'
|
|
||||||
debug_pre: false
|
|
|
@ -5,6 +5,7 @@ dependencies:
|
||||||
config:
|
config:
|
||||||
- field.storage.node.field_attachments
|
- field.storage.node.field_attachments
|
||||||
- field.storage.node.field_distributor
|
- field.storage.node.field_distributor
|
||||||
|
- field.storage.node.field_index
|
||||||
- field.storage.node.field_linked_articles
|
- field.storage.node.field_linked_articles
|
||||||
- field.storage.node.field_linked_materials
|
- field.storage.node.field_linked_materials
|
||||||
- field.storage.node.field_manufacturer
|
- field.storage.node.field_manufacturer
|
||||||
|
@ -310,7 +311,7 @@ display:
|
||||||
action_id: views_bulk_edit
|
action_id: views_bulk_edit
|
||||||
preconfiguration:
|
preconfiguration:
|
||||||
label_override: ''
|
label_override: ''
|
||||||
get_bundles_from_results: 1
|
get_bundles_from_results: true
|
||||||
-
|
-
|
||||||
action_id: views_bulk_operations_delete_entity
|
action_id: views_bulk_operations_delete_entity
|
||||||
preconfiguration:
|
preconfiguration:
|
||||||
|
@ -2362,7 +2363,7 @@ display:
|
||||||
action_id: views_bulk_edit
|
action_id: views_bulk_edit
|
||||||
preconfiguration:
|
preconfiguration:
|
||||||
label_override: ''
|
label_override: ''
|
||||||
get_bundles_from_results: 1
|
get_bundles_from_results: true
|
||||||
-
|
-
|
||||||
action_id: views_bulk_operations_delete_entity
|
action_id: views_bulk_operations_delete_entity
|
||||||
preconfiguration:
|
preconfiguration:
|
||||||
|
@ -3563,6 +3564,72 @@ display:
|
||||||
entity_type: node
|
entity_type: node
|
||||||
entity_field: created
|
entity_field: created
|
||||||
plugin_id: field
|
plugin_id: field
|
||||||
|
field_index:
|
||||||
|
id: field_index
|
||||||
|
table: node__field_index
|
||||||
|
field: field_index
|
||||||
|
relationship: none
|
||||||
|
group_type: group
|
||||||
|
admin_label: ''
|
||||||
|
label: Index
|
||||||
|
exclude: false
|
||||||
|
alter:
|
||||||
|
alter_text: false
|
||||||
|
text: ''
|
||||||
|
make_link: false
|
||||||
|
path: ''
|
||||||
|
absolute: false
|
||||||
|
external: false
|
||||||
|
replace_spaces: false
|
||||||
|
path_case: none
|
||||||
|
trim_whitespace: false
|
||||||
|
alt: ''
|
||||||
|
rel: ''
|
||||||
|
link_class: ''
|
||||||
|
prefix: ''
|
||||||
|
suffix: ''
|
||||||
|
target: ''
|
||||||
|
nl2br: false
|
||||||
|
max_length: 0
|
||||||
|
word_boundary: true
|
||||||
|
ellipsis: true
|
||||||
|
more_link: false
|
||||||
|
more_link_text: ''
|
||||||
|
more_link_path: ''
|
||||||
|
strip_tags: false
|
||||||
|
trim: false
|
||||||
|
preserve_tags: ''
|
||||||
|
html: false
|
||||||
|
element_type: ''
|
||||||
|
element_class: ''
|
||||||
|
element_label_type: ''
|
||||||
|
element_label_class: ''
|
||||||
|
element_label_colon: true
|
||||||
|
element_wrapper_type: ''
|
||||||
|
element_wrapper_class: ''
|
||||||
|
element_default_classes: true
|
||||||
|
empty: ''
|
||||||
|
hide_empty: false
|
||||||
|
empty_zero: false
|
||||||
|
hide_alter_empty: true
|
||||||
|
click_sort_column: value
|
||||||
|
type: computed_integer
|
||||||
|
settings:
|
||||||
|
cache_unit: '-1'
|
||||||
|
cache_duration: '1'
|
||||||
|
thousand_separator: ''
|
||||||
|
prefix_suffix: 1
|
||||||
|
group_column: value
|
||||||
|
group_columns: { }
|
||||||
|
group_rows: true
|
||||||
|
delta_limit: 0
|
||||||
|
delta_offset: 0
|
||||||
|
delta_reversed: false
|
||||||
|
delta_first_last: false
|
||||||
|
multi_type: separator
|
||||||
|
separator: ', '
|
||||||
|
field_api_classes: false
|
||||||
|
plugin_id: field
|
||||||
style:
|
style:
|
||||||
type: table
|
type: table
|
||||||
options:
|
options:
|
||||||
|
@ -3577,8 +3644,8 @@ display:
|
||||||
columns:
|
columns:
|
||||||
views_bulk_operations_bulk_form: views_bulk_operations_bulk_form
|
views_bulk_operations_bulk_form: views_bulk_operations_bulk_form
|
||||||
nid: nid
|
nid: nid
|
||||||
title: title
|
|
||||||
field_reference: title
|
field_reference: title
|
||||||
|
title: title
|
||||||
field_materiau_images: title
|
field_materiau_images: title
|
||||||
operations: title
|
operations: title
|
||||||
is_locked: title
|
is_locked: title
|
||||||
|
@ -3589,11 +3656,13 @@ display:
|
||||||
field_linked_materials: field_linked_materials
|
field_linked_materials: field_linked_materials
|
||||||
field_linked_articles: field_linked_articles
|
field_linked_articles: field_linked_articles
|
||||||
field_samples: field_samples
|
field_samples: field_samples
|
||||||
|
field_attachments: field_attachments
|
||||||
field_workflow: field_workflow
|
field_workflow: field_workflow
|
||||||
field_migration: field_migration
|
field_migration: field_migration
|
||||||
field_memo: field_memo
|
field_memo: field_memo
|
||||||
changed: changed
|
changed: changed
|
||||||
created: created
|
created: created
|
||||||
|
field_index: field_index
|
||||||
info:
|
info:
|
||||||
views_bulk_operations_bulk_form:
|
views_bulk_operations_bulk_form:
|
||||||
align: ''
|
align: ''
|
||||||
|
@ -3607,13 +3676,6 @@ display:
|
||||||
separator: ''
|
separator: ''
|
||||||
empty_column: false
|
empty_column: false
|
||||||
responsive: ''
|
responsive: ''
|
||||||
title:
|
|
||||||
sortable: false
|
|
||||||
default_sort_order: asc
|
|
||||||
align: views-align-left
|
|
||||||
separator: ''
|
|
||||||
empty_column: false
|
|
||||||
responsive: ''
|
|
||||||
field_reference:
|
field_reference:
|
||||||
sortable: false
|
sortable: false
|
||||||
default_sort_order: asc
|
default_sort_order: asc
|
||||||
|
@ -3621,6 +3683,13 @@ display:
|
||||||
separator: ''
|
separator: ''
|
||||||
empty_column: false
|
empty_column: false
|
||||||
responsive: ''
|
responsive: ''
|
||||||
|
title:
|
||||||
|
sortable: false
|
||||||
|
default_sort_order: asc
|
||||||
|
align: views-align-left
|
||||||
|
separator: ''
|
||||||
|
empty_column: false
|
||||||
|
responsive: ''
|
||||||
field_materiau_images:
|
field_materiau_images:
|
||||||
align: ''
|
align: ''
|
||||||
separator: ''
|
separator: ''
|
||||||
|
@ -3673,6 +3742,11 @@ display:
|
||||||
separator: ''
|
separator: ''
|
||||||
empty_column: false
|
empty_column: false
|
||||||
responsive: ''
|
responsive: ''
|
||||||
|
field_attachments:
|
||||||
|
align: ''
|
||||||
|
separator: ''
|
||||||
|
empty_column: false
|
||||||
|
responsive: ''
|
||||||
field_workflow:
|
field_workflow:
|
||||||
sortable: false
|
sortable: false
|
||||||
default_sort_order: asc
|
default_sort_order: asc
|
||||||
|
@ -3688,6 +3762,8 @@ display:
|
||||||
empty_column: false
|
empty_column: false
|
||||||
responsive: ''
|
responsive: ''
|
||||||
field_memo:
|
field_memo:
|
||||||
|
sortable: false
|
||||||
|
default_sort_order: asc
|
||||||
align: ''
|
align: ''
|
||||||
separator: ''
|
separator: ''
|
||||||
empty_column: false
|
empty_column: false
|
||||||
|
@ -3706,6 +3782,13 @@ display:
|
||||||
separator: ''
|
separator: ''
|
||||||
empty_column: false
|
empty_column: false
|
||||||
responsive: ''
|
responsive: ''
|
||||||
|
field_index:
|
||||||
|
sortable: true
|
||||||
|
default_sort_order: desc
|
||||||
|
align: ''
|
||||||
|
separator: ''
|
||||||
|
empty_column: false
|
||||||
|
responsive: ''
|
||||||
default: changed
|
default: changed
|
||||||
empty_table: false
|
empty_table: false
|
||||||
row:
|
row:
|
||||||
|
@ -4398,6 +4481,7 @@ display:
|
||||||
tags:
|
tags:
|
||||||
- 'config:field.storage.node.field_attachments'
|
- 'config:field.storage.node.field_attachments'
|
||||||
- 'config:field.storage.node.field_distributor'
|
- 'config:field.storage.node.field_distributor'
|
||||||
|
- 'config:field.storage.node.field_index'
|
||||||
- 'config:field.storage.node.field_linked_articles'
|
- 'config:field.storage.node.field_linked_articles'
|
||||||
- 'config:field.storage.node.field_linked_materials'
|
- 'config:field.storage.node.field_linked_materials'
|
||||||
- 'config:field.storage.node.field_manufacturer'
|
- 'config:field.storage.node.field_manufacturer'
|
||||||
|
@ -6186,7 +6270,7 @@ display:
|
||||||
action_id: views_bulk_edit
|
action_id: views_bulk_edit
|
||||||
preconfiguration:
|
preconfiguration:
|
||||||
label_override: ''
|
label_override: ''
|
||||||
get_bundles_from_results: 1
|
get_bundles_from_results: true
|
||||||
-
|
-
|
||||||
action_id: views_bulk_operations_delete_entity
|
action_id: views_bulk_operations_delete_entity
|
||||||
preconfiguration:
|
preconfiguration:
|
||||||
|
|
|
@ -16,6 +16,8 @@ function computed_field_field_index_compute($entity_type_manager, $entity, $fiel
|
||||||
|
|
||||||
// the node is new
|
// the node is new
|
||||||
// get all same entities in same family
|
// get all same entities in same family
|
||||||
|
$bundle = $entity->bundle();
|
||||||
|
$entity_type_id = $entity->getEntityTypeId();
|
||||||
$query = \Drupal::entityQuery($entity->getEntityTypeId())
|
$query = \Drupal::entityQuery($entity->getEntityTypeId())
|
||||||
->condition('type', $entity->bundle())
|
->condition('type', $entity->bundle())
|
||||||
->condition('field_famille', $famille)
|
->condition('field_famille', $famille)
|
||||||
|
@ -28,7 +30,7 @@ function computed_field_field_index_compute($entity_type_manager, $entity, $fiel
|
||||||
if(is_array($nids)){
|
if(is_array($nids)){
|
||||||
$nid = array_pop($nids);
|
$nid = array_pop($nids);
|
||||||
if ($nid) {
|
if ($nid) {
|
||||||
$last = entity_load($entity->getEntityTypeId(), array_pop($nids));
|
$last = entity_load($entity->getEntityTypeId(), $nid); // array_pop($nids)
|
||||||
// get identifiants fo these entities
|
// get identifiants fo these entities
|
||||||
$index = $last->get('field_index')->getValue()[0]['value'] + 1;
|
$index = $last->get('field_index')->getValue()[0]['value'] + 1;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue