diff --git a/modules/custom/az_core/config/install/field.storage.node.field_az_suffix.yml b/modules/custom/az_core/config/install/field.storage.node.field_az_suffix.yml new file mode 100644 index 0000000000..ae7961ba93 --- /dev/null +++ b/modules/custom/az_core/config/install/field.storage.node.field_az_suffix.yml @@ -0,0 +1,20 @@ +langcode: en +status: true +dependencies: + module: + - node +id: node.field_az_suffix +field_name: field_az_suffix +entity_type: node +type: string +settings: + max_length: 255 + case_sensitive: false + is_ascii: false +module: core +locked: false +cardinality: -1 +translatable: true +indexes: { } +persist_with_no_fields: false +custom_storage: false diff --git a/modules/custom/az_demo/data/az_demo_person_node.json b/modules/custom/az_demo/data/az_demo_person_node.json index a59b04067e..800a7c2fe2 100644 --- a/modules/custom/az_demo/data/az_demo_person_node.json +++ b/modules/custom/az_demo/data/az_demo_person_node.json @@ -4,6 +4,7 @@ "id":1, "az_lname" : "And", "az_fname" : "Anders", + "az_suffix" : "M.A.", "az_email" : "donald@arizona.edu", "az_bio" : "

Enjoyed a lengthy Hollywood career before his current employment at the University of Arizona (joint with the University of Oregon).

", "az_phones" : "031-667-1071|053-246-1514", @@ -24,6 +25,7 @@ "id":2, "az_lname" : "Ælling", "az_fname" : "Grimme", + "az_suffix" : "M.S.", "az_email" : "uglyd@arizona.edu", "az_bio" : "

A leading expert on both developmental psychology and characters in the novels of Marcel Proust.

", "az_phones" : "071-388-2333", @@ -44,6 +46,7 @@ "id":3, "az_lname" : "An'ersen", "az_fname" : "José", + "az_suffix" : "M.A.|Ph.D.", "az_email" : "hcandersen@arizona.edu", "az_bio" : "

His life's work has been to contradict everything that Kierkegaard stood for.

", "az_phones" : "071-831-6181", @@ -64,6 +67,7 @@ "id":4, "az_lname" : "Quack", "az_fname" : "Albertina", + "az_suffix" : "M.A.|Ph.D.", "az_email" : "aquack@arizona.edu", "az_bio" : "

Dr. Quack is a leading expert on the Cult of the Sacred Duck, a highly significant influence on Urnfield and Hallstatt iconography in Central Europe, but now unfortunately lapsed into obscurity.

", "az_phones" : "086-572-2311", @@ -84,6 +88,7 @@ "id":5, "az_lname" : "Nasier", "az_fname" : "Alcofribas", + "az_suffix" : "Ph.D.", "az_email" : "alcofribasnasier@arizona.edu", "az_bio" : "

A central figure in the study of late fifteenth to early sixteenth century French literature.

", "az_phones" : "091-374-2832", @@ -108,6 +113,7 @@ "id":6, "az_lname" : "Urquhart", "az_fname" : "Thomas", + "az_suffix" : "Ph.D.", "az_email" : "turquhart@arizona.edu", "az_bio" : "

Author of Trissotetras, a radically different approach to trigonometric notation.

", "az_phones" : "041-334-8100", @@ -128,6 +134,7 @@ "id":7, "az_lname" : "Horne", "az_fname" : "Janet", + "az_suffix" : "M.S.", "az_email" : "jhorne@arizona.edu", "az_bio" : "

Currently investigating the use of herbal supplements as an alternative to nutrition.

", "az_phones" : "041-552-8467", @@ -148,6 +155,7 @@ "id":8, "az_lname" : "de Espinosa", "az_fname" : "Antonio", + "az_suffix" : "M.S.", "az_email" : "typefoundry@arizona.edu", "az_bio" : "

A leading proponent of high-quality book production in the New World.

", "az_phones" : "023-475-2795|021-471-2611", @@ -168,6 +176,7 @@ "id":9, "az_lname" : "Strozzi", "az_fname" : "Barbara", + "az_suffix" : "M.M.", "az_email" : "bstrozzi@arizona.edu", "az_bio" : "

Known for a productive and distinguished career in composition, as well as vocal performance.

", "az_phones" : "081-981-7331", @@ -188,6 +197,7 @@ "id":10, "az_lname" : "Muse", "az_fname" : "Urania", + "az_suffix" : "Ph.D.", "az_email" : "urania@arizona.edu", "az_bio" : "

The inspiration for generations of astronomers.

", "az_phones" : "022-333-8848", @@ -208,6 +218,7 @@ "id":11, "az_lname" : "Giovanni", "az_fname" : "Donald", + "az_suffix" : "Ph.D.", "az_email" : "stonedguest@arizona.edu", "az_bio" : "

At final count, his regionally localized accomplishments stood at at least 1003.

", "az_phones" : "086-572-2311", @@ -228,6 +239,7 @@ "id":12, "az_lname" : "Wildcat", "az_fname" : "Wilbur", + "az_suffix" : "M.S.", "az_email" : "wilbur@arizona.edu", "az_bio" : "

On April 17, 1916, the UA's live mascot Rufus Wildcat (named after then UA President Rufus Bernard Von KleinSmidt) met with an untimely death. Decades later, after being without a mascot, UA students Richard Heller, '65, and John Paquette, '61 developed the idea for a costumed human mascot. On November 7, 1959, Wilbur the Wildcat was \"born,\" making his debut at the UA vs. Texas Tech football game. The new mascot, portrayed by Ed Stuckenoff, `64, was an immediate hit

The original costume was head-to-toe fur with an American flag patch on the left shoulder. It was cartoon-style with big round eyes, a button nose, and a curved black line for a mouth. A few years later, in an attempt to look more \"human\", an upgraded version of Wilbur eliminated the fur body and replaced it with an Arizona sweater and pair of slacks. This look lasted until the 1970's, during which Wilbur underwent a \"Rhinestone Cowboy\" phase. In this costume, Wilbur donned a vest and blue jeans, cowboy boots, a holster and gun, and an oversized paper-mache head. This look lasted until 1982, when Wilbur re-acquired his fur.

Since the early 1980's, Wilbur the Wildcat's character and image has undergone various style changes while maintaining a \"furry\" body. Today, Wilbur, along with his counterpart and wife, Wilma the Wildcat, and the Arizona Cheerleaders, is part of the Spirit Program within Arizona Athletics Department. Wilbur is not only present at all UA home football and men's basketball games, but he is also involved in many aspects of campus life. In addition to campus commitments, Wilbur and Wilma the Wildcat spend a great deal of time working with local community organizations and non-profit groups.


Wildcats Nickname

The Wildcats got their name after a hard fought football game against the Occidental College Tigers on November 7, 1914. A Los Angeles Times columnist wrote that the Arizona team \"Showed the fight of Wildcats.\"


Wilbur Facts

", "az_phones" : "520-621-5555", @@ -248,6 +260,7 @@ "id":13, "az_lname" : "Wildcat", "az_fname" : "Wilma", + "az_suffix" : "Ph.D.", "az_email" : "wilma@arizona.edu", "az_bio" : "

At games, Wilma helps keep crowds and fans motivated with her enthusiasim and strong UA spirit. She attributes her success as a kind, loveable wildcat to the endurence, preperation, and devotion she possesses.


Wilma Facts

", "az_phones" : "520-621-5555", diff --git a/modules/custom/az_demo/migrations/az_demo_person_node.yml b/modules/custom/az_demo/migrations/az_demo_person_node.yml index 797d9f4e89..2bcf77d10e 100644 --- a/modules/custom/az_demo/migrations/az_demo_person_node.yml +++ b/modules/custom/az_demo/migrations/az_demo_person_node.yml @@ -24,6 +24,9 @@ source: - name: field_az_lname selector: az_lname + - + name: field_az_suffix + selector: az_suffix - name: field_az_email selector: az_email @@ -64,6 +67,11 @@ process: field_az_lname: field_az_lname + field_az_suffix: + plugin: explode + source: field_az_suffix + delimiter: '|' + field_az_email: field_az_email field_az_titles: diff --git a/modules/custom/az_person/az_person.module b/modules/custom/az_person/az_person.module index c7ee3e98ca..fd76f2507b 100644 --- a/modules/custom/az_person/az_person.module +++ b/modules/custom/az_person/az_person.module @@ -6,6 +6,9 @@ */ use Drupal\Core\Entity\EntityTypeInterface; +use Drupal\Core\Entity\EntityInterface; +use Drupal\Core\Entity\Display\EntityViewDisplayInterface; +use Drupal\node\Entity\NodeType; /** * Implements hook_preprocess_node(). @@ -44,3 +47,50 @@ function az_person_entity_bundle_field_info_alter(&$fields, EntityTypeInterface $fields['field_az_netid']->addConstraint('UniqueField'); } } + +/** + * Implements hook_entity_extra_field_info(). + */ +function az_person_entity_extra_field_info() { + $extra = []; + + // Check to see if our content type exists. + $bundle = NodeType::load('az_person'); + if ($bundle) { + // Comma pseudo field. + $extra['node'][$bundle->id()]['display']['az_person_suffix'] = [ + 'label' => t('Person name suffix with leading comma.'), + 'description' => "This is a pseudo field from az_person.", + 'weight' => 50, + 'visible' => FALSE, + ]; + } + + return $extra; +} + +/** + * Implements hook_ENTITY_TYPE_view(). + */ +function az_person_node_view(array &$build, EntityInterface $entity, EntityViewDisplayInterface $display, $view_mode) { + if ($entity instanceof \Drupal\Core\Entity\FieldableEntityInterface) { + if ($entity->hasField('field_az_suffix')) { + $suffix_field = $entity->get('field_az_suffix'); + $items = []; + foreach ($suffix_field as $suffix_item) { + $items[] = [ + '#markup' => $suffix_item->value, + '#wrapper_attributes' => ['class' => ['list-inline-item']], + ]; + } + $build['az_person_suffix'] = [ + '#theme' => 'item_list', + '#items' => $items, + '#context' => ['list_style' => 'comma-list'], + '#attributes' => ['class' => ['list-inline']], + '#wrapper_attributes' => ['class' => ['inline','with-leading-comma']], + '#theme_wrappers' => [], + ]; + } + } +} diff --git a/modules/custom/az_person/config/install/core.entity_view_display.node.az_person.az_card.yml b/modules/custom/az_person/config/install/core.entity_view_display.node.az_person.az_card.yml index 331bb955d3..e82f489f73 100644 --- a/modules/custom/az_person/config/install/core.entity_view_display.node.az_person.az_card.yml +++ b/modules/custom/az_person/config/install/core.entity_view_display.node.az_person.az_card.yml @@ -18,6 +18,7 @@ dependencies: - field.field.node.az_person.field_az_person_category_sec - field.field.node.az_person.field_az_phones - field.field.node.az_person.field_az_pronouns + - field.field.node.az_person.field_az_suffix - field.field.node.az_person.field_az_titles - node.type.az_person module: @@ -126,6 +127,7 @@ third_party_settings: group_title_link: children: - smart_title + - az_person_suffix label: 'Title Link' parent_name: group_title_heading region: content @@ -149,12 +151,17 @@ targetEntityType: node bundle: az_person mode: az_card content: + az_person_suffix: + settings: { } + third_party_settings: { } + weight: 10 + region: content field_az_email: type: email_mailto label: hidden settings: { } third_party_settings: { } - weight: 7 + weight: 8 region: content field_az_media_image: type: entity_reference_entity_view @@ -179,7 +186,7 @@ content: settings: link_to_entity: false third_party_settings: { } - weight: 8 + weight: 9 region: content field_az_titles: type: string @@ -206,4 +213,5 @@ hidden: field_az_netid: true field_az_person_category: true field_az_person_category_sec: true + field_az_suffix: true links: true diff --git a/modules/custom/az_person/config/install/core.entity_view_display.node.az_person.az_row.yml b/modules/custom/az_person/config/install/core.entity_view_display.node.az_person.az_row.yml index 617f8c3a67..cf02d1f354 100644 --- a/modules/custom/az_person/config/install/core.entity_view_display.node.az_person.az_row.yml +++ b/modules/custom/az_person/config/install/core.entity_view_display.node.az_person.az_row.yml @@ -18,6 +18,7 @@ dependencies: - field.field.node.az_person.field_az_person_category_sec - field.field.node.az_person.field_az_phones - field.field.node.az_person.field_az_pronouns + - field.field.node.az_person.field_az_suffix - field.field.node.az_person.field_az_titles - image.style.az_medium - node.type.az_person @@ -113,6 +114,7 @@ third_party_settings: group_title_link: children: - smart_title + - az_person_suffix label: 'Title Link' parent_name: group_title_heading region: content @@ -170,12 +172,17 @@ targetEntityType: node bundle: az_person mode: az_row content: + az_person_suffix: + settings: { } + third_party_settings: { } + weight: 6 + region: content field_az_email: type: email_mailto label: hidden settings: { } third_party_settings: { } - weight: 6 + weight: 7 region: content field_az_media_image: type: media_thumbnail @@ -202,7 +209,7 @@ content: settings: link_to_entity: false third_party_settings: { } - weight: 7 + weight: 8 region: content field_az_titles: type: string @@ -210,7 +217,7 @@ content: settings: link_to_entity: false third_party_settings: { } - weight: 22 + weight: 21 region: content smart_title: settings: { } @@ -229,4 +236,5 @@ hidden: field_az_netid: true field_az_person_category: true field_az_person_category_sec: true + field_az_suffix: true links: true diff --git a/modules/custom/az_person/config/install/core.entity_view_display.node.az_person.az_row_with_background.yml b/modules/custom/az_person/config/install/core.entity_view_display.node.az_person.az_row_with_background.yml index e75108aed7..15545018b4 100644 --- a/modules/custom/az_person/config/install/core.entity_view_display.node.az_person.az_row_with_background.yml +++ b/modules/custom/az_person/config/install/core.entity_view_display.node.az_person.az_row_with_background.yml @@ -13,11 +13,13 @@ dependencies: - field.field.node.az_person.field_az_links - field.field.node.az_person.field_az_lname - field.field.node.az_person.field_az_media_image + - field.field.node.az_person.field_az_metatag - field.field.node.az_person.field_az_netid - field.field.node.az_person.field_az_person_category - field.field.node.az_person.field_az_person_category_sec - field.field.node.az_person.field_az_phones - field.field.node.az_person.field_az_pronouns + - field.field.node.az_person.field_az_suffix - field.field.node.az_person.field_az_titles - node.type.az_person module: @@ -121,6 +123,7 @@ third_party_settings: group_column_text: children: - smart_title + - az_person_suffix - group_job_titles - group_view_person label: 'Column - Text' @@ -145,7 +148,7 @@ third_party_settings: label: 'Job Title(s)' parent_name: group_column_text region: content - weight: 9 + weight: 10 format_type: html_element format_settings: classes: 'text-muted font-weight-normal' @@ -163,7 +166,7 @@ third_party_settings: label: 'View profile' parent_name: group_column_text region: content - weight: 10 + weight: 11 format_type: html_element format_settings: classes: 'card-clickable-link mt-2 pb-3' @@ -193,6 +196,11 @@ targetEntityType: node bundle: az_person mode: az_row_with_background content: + az_person_suffix: + settings: { } + third_party_settings: { } + weight: 9 + region: content field_az_media_image: type: entity_reference_entity_view label: hidden @@ -208,7 +216,7 @@ content: settings: link_to_entity: false third_party_settings: { } - weight: 10 + weight: 3 region: content smart_title: settings: { } @@ -225,9 +233,11 @@ hidden: field_az_link: true field_az_links: true field_az_lname: true + field_az_metatag: true field_az_netid: true field_az_person_category: true field_az_person_category_sec: true field_az_phones: true field_az_pronouns: true + field_az_suffix: true links: true diff --git a/modules/custom/az_person/config/install/core.entity_view_display.node.az_person.default.yml b/modules/custom/az_person/config/install/core.entity_view_display.node.az_person.default.yml index 2d7fa49b57..99176430b9 100644 --- a/modules/custom/az_person/config/install/core.entity_view_display.node.az_person.default.yml +++ b/modules/custom/az_person/config/install/core.entity_view_display.node.az_person.default.yml @@ -17,6 +17,7 @@ dependencies: - field.field.node.az_person.field_az_person_category_sec - field.field.node.az_person.field_az_phones - field.field.node.az_person.field_az_pronouns + - field.field.node.az_person.field_az_suffix - field.field.node.az_person.field_az_titles - image.style.az_medium - node.type.az_person @@ -34,12 +35,9 @@ third_party_settings: enabled: true settings: smart_title__link: false - smart_title__tag: h1 + smart_title__tag: span smart_title__classes: - - node__title - - text-blue - - mt-md-0 - - mb-0 + - d-inline field_group: group_row: children: @@ -64,7 +62,7 @@ third_party_settings: speed: fast group_col_12_name_titles: children: - - smart_title + - group_az_name - group_titles label: 'Col 12 - Name & Titles' parent_name: group_row @@ -154,7 +152,7 @@ third_party_settings: label: 'Card Body' parent_name: group_card region: content - weight: 7 + weight: 12 format_type: html_element format_settings: classes: card-body @@ -173,7 +171,7 @@ third_party_settings: label: Titles parent_name: group_col_12_name_titles region: content - weight: 8 + weight: 13 format_type: html_element format_settings: classes: 'h4 d-block mt-0' @@ -224,11 +222,37 @@ third_party_settings: attributes: '' effect: none speed: fast + group_az_name: + children: + - smart_title + - az_person_suffix + label: Name + parent_name: group_col_12_name_titles + region: content + weight: 10 + format_type: html_element + format_settings: + classes: 'node__title text-blue mt-md-0 mb-0' + show_empty_fields: false + id: '' + label_as_html: false + element: h1 + show_label: false + label_element: h3 + label_element_classes: '' + attributes: '' + effect: none + speed: fast id: node.az_person.default targetEntityType: node bundle: az_person mode: default content: + az_person_suffix: + settings: { } + third_party_settings: { } + weight: 12 + region: content field_az_address: type: text_default label: hidden @@ -257,7 +281,7 @@ content: settings: link_to_entity: false third_party_settings: { } - weight: 10 + weight: 11 region: content field_az_email: type: email_mailto @@ -287,7 +311,7 @@ content: image_loading: attribute: lazy third_party_settings: { } - weight: 6 + weight: 11 region: content field_az_person_category: type: entity_reference_entity_view @@ -296,7 +320,7 @@ content: view_mode: az_badge link: false third_party_settings: { } - weight: 11 + weight: 12 region: content field_az_person_category_sec: type: entity_reference_entity_view @@ -305,7 +329,7 @@ content: view_mode: az_badge link: false third_party_settings: { } - weight: 12 + weight: 13 region: content field_az_phones: type: telephone_link @@ -334,11 +358,12 @@ content: smart_title: settings: { } third_party_settings: { } - weight: 7 + weight: 11 region: content hidden: field_az_fname: true field_az_link: true field_az_lname: true field_az_netid: true + field_az_suffix: true links: true diff --git a/modules/custom/az_person/config/install/core.entity_view_display.node.az_person.teaser.yml b/modules/custom/az_person/config/install/core.entity_view_display.node.az_person.teaser.yml index 049cec5dc5..350fd9472e 100644 --- a/modules/custom/az_person/config/install/core.entity_view_display.node.az_person.teaser.yml +++ b/modules/custom/az_person/config/install/core.entity_view_display.node.az_person.teaser.yml @@ -18,6 +18,7 @@ dependencies: - field.field.node.az_person.field_az_person_category_sec - field.field.node.az_person.field_az_phones - field.field.node.az_person.field_az_pronouns + - field.field.node.az_person.field_az_suffix - field.field.node.az_person.field_az_titles - node.type.az_person module: @@ -34,9 +35,10 @@ content: links: settings: { } third_party_settings: { } - weight: 100 + weight: 0 region: content hidden: + az_person_suffix: true field_az_address: true field_az_attachments: true field_az_body: true @@ -52,5 +54,6 @@ hidden: field_az_person_category_sec: true field_az_phones: true field_az_pronouns: true + field_az_suffix: true field_az_titles: true smart_title: true diff --git a/modules/custom/az_person/config/install/field.field.node.az_person.field_az_suffix.yml b/modules/custom/az_person/config/install/field.field.node.az_person.field_az_suffix.yml new file mode 100644 index 0000000000..41bfa9837e --- /dev/null +++ b/modules/custom/az_person/config/install/field.field.node.az_person.field_az_suffix.yml @@ -0,0 +1,18 @@ +langcode: en +status: true +dependencies: + config: + - field.storage.node.field_az_suffix + - node.type.az_person +id: node.az_person.field_az_suffix +field_name: field_az_suffix +entity_type: node +bundle: az_person +label: Suffix(es) +description: '' +required: false +translatable: false +default_value: { } +default_value_callback: '' +settings: { } +field_type: string diff --git a/modules/custom/az_person/css/az_person.css b/modules/custom/az_person/css/az_person.css index 85605c5b1c..cc3b7f7d53 100644 --- a/modules/custom/az_person/css/az_person.css +++ b/modules/custom/az_person/css/az_person.css @@ -38,3 +38,8 @@ .az-person-modal .az-person-modal-close { mix-blend-mode: difference; } + +.with-leading-comma:before { + display: inline; + content: ', '; +}