diff --git a/apbs_entities.info.yml b/apbs_entities.info.yml index e209625bc9c27cf723a1494adbab1f23f7ad3efb..944462ea653e14ab2935bfa4357839b775ff7a99 100644 --- a/apbs_entities.info.yml +++ b/apbs_entities.info.yml @@ -157,6 +157,7 @@ config_devel: - field.field.easy_email.confirm_order.field_booking - field.field.easy_email.confirm_signed_contract.field_booking - field.field.easy_email.reminder_before_arrival.field_booking + - field.field.taxonomy_term.animal_flag.field_hide - field.field.taxonomy_term.breed.field_animal_type - field.field.taxonomy_term.breed.field_price - field.field.taxonomy_term.room.field_area @@ -170,6 +171,7 @@ config_devel: - field.storage.easy_email.field_booking - field.storage.taxonomy_term.field_animal_type - field.storage.taxonomy_term.field_area + - field.storage.taxonomy_term.field_hide - field.storage.taxonomy_term.field_name - field.storage.taxonomy_term.field_price - field.storage.taxonomy_term.field_square diff --git a/config/install/field.field.taxonomy_term.animal_flag.field_hide.yml b/config/install/field.field.taxonomy_term.animal_flag.field_hide.yml new file mode 100644 index 0000000000000000000000000000000000000000..55ae94658e4ce85e56681575c21c8cef7108ca5d --- /dev/null +++ b/config/install/field.field.taxonomy_term.animal_flag.field_hide.yml @@ -0,0 +1,20 @@ +langcode: en +status: true +dependencies: + config: + - field.storage.taxonomy_term.field_hide + - taxonomy.vocabulary.animal_flag +id: taxonomy_term.animal_flag.field_hide +field_name: field_hide +entity_type: taxonomy_term +bundle: animal_flag +label: 'Hide tagged animals from selection list' +description: '' +required: false +translatable: false +default_value: { } +default_value_callback: '' +settings: + on_label: 'On' + off_label: 'Off' +field_type: boolean diff --git a/config/install/field.storage.taxonomy_term.field_hide.yml b/config/install/field.storage.taxonomy_term.field_hide.yml new file mode 100644 index 0000000000000000000000000000000000000000..76df7be5d442016a6a149bc715726c27eef258a0 --- /dev/null +++ b/config/install/field.storage.taxonomy_term.field_hide.yml @@ -0,0 +1,17 @@ +langcode: en +status: true +dependencies: + module: + - taxonomy +id: taxonomy_term.field_hide +field_name: field_hide +entity_type: taxonomy_term +type: boolean +settings: { } +module: core +locked: false +cardinality: 1 +translatable: true +indexes: { } +persist_with_no_fields: false +custom_storage: false diff --git a/config/optional/views.view.allocations_today.yml b/config/optional/views.view.allocations_today.yml index 53eda3c5b3303c16a09bb598914cab9fb6dfd98e..1feaefa626bb2b583970565a0609738d3ddeed90 100644 --- a/config/optional/views.view.allocations_today.yml +++ b/config/optional/views.view.allocations_today.yml @@ -2,6 +2,7 @@ langcode: en status: true dependencies: config: + - field.storage.apbs_animal.field_flags - field.storage.taxonomy_term.field_area - field.storage.taxonomy_term.field_square module: @@ -285,6 +286,69 @@ display: multi_type: separator separator: ', ' field_api_classes: false + field_flags: + id: field_flags + table: apbs_animal__field_flags + field: field_flags + relationship: animal + group_type: group + admin_label: '' + plugin_id: field + label: '' + 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: false + element_wrapper_type: '' + element_wrapper_class: '' + element_default_classes: true + empty: '' + hide_empty: false + empty_zero: false + hide_alter_empty: true + click_sort_column: target_id + type: entity_reference_label + settings: + link: false + group_column: target_id + 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 breed: id: breed table: apbs_animal @@ -894,6 +958,7 @@ display: - url - user.permissions tags: + - 'config:field.storage.apbs_animal.field_flags' - 'config:field.storage.taxonomy_term.field_area' - 'config:field.storage.taxonomy_term.field_square' block_1: @@ -1160,6 +1225,69 @@ display: multi_type: separator separator: ', ' field_api_classes: false + field_flags: + id: field_flags + table: apbs_animal__field_flags + field: field_flags + relationship: animal + group_type: group + admin_label: '' + plugin_id: field + label: '' + 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: false + element_wrapper_type: '' + element_wrapper_class: '' + element_default_classes: true + empty: '' + hide_empty: false + empty_zero: false + hide_alter_empty: true + click_sort_column: target_id + type: entity_reference_label + settings: + link: false + group_column: target_id + 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 defaults: use_ajax: false fields: false @@ -1174,6 +1302,7 @@ display: - url - user.permissions tags: + - 'config:field.storage.apbs_animal.field_flags' - 'config:field.storage.taxonomy_term.field_area' - 'config:field.storage.taxonomy_term.field_square' page_1: @@ -1192,5 +1321,6 @@ display: - url - user.permissions tags: + - 'config:field.storage.apbs_animal.field_flags' - 'config:field.storage.taxonomy_term.field_area' - 'config:field.storage.taxonomy_term.field_square' diff --git a/css/apbs_view_allocations_today.css b/css/apbs_view_allocations_today.css index a3845c209e0d62d9d3db11f03a9ce0a37a2f60f5..b55ac7cf35ae6151e77fc70af0af7501d8c19a67 100644 --- a/css/apbs_view_allocations_today.css +++ b/css/apbs_view_allocations_today.css @@ -1,7 +1,7 @@ h3 { font-size: 2.5rem; } -.views-field { +.views-row { font-size: 2rem; } .views-field.views-field-label { @@ -17,3 +17,6 @@ h3 { .view-allocations-today div.field-content { padding-left: 4rem; } +.view-allocations-today .views-field-field-flags { + float: right; +} diff --git a/src/Plugin/EntityReferenceSelection/Animals.php b/src/Plugin/EntityReferenceSelection/Animals.php index 72c1023b7858f5f1688862e2cfe3d515fb790af7..9fc34826d634a5e5f71d0b01e487337d305664c3 100644 --- a/src/Plugin/EntityReferenceSelection/Animals.php +++ b/src/Plugin/EntityReferenceSelection/Animals.php @@ -70,7 +70,13 @@ class Animals extends DefaultSelection { } if (isset($match)) { $query->sort('label'); - $query->notExists('field_flags'); + $hiddenFlags = $this->entityTypeManager->getStorage('taxonomy_term')->getQuery() + ->accessCheck(FALSE) + ->condition('field_hide', 1) + ->execute(); + if ($hiddenFlags) { + $query->condition('field_flags', $hiddenFlags, 'NOT IN'); + } } } elseif ($booking = Booking::load($bookingId)) {