Skip to content

Commit

Permalink
Merge pull request #10 from asuengineering/jcox-v16p3
Browse files Browse the repository at this point in the history
v1.6 part 3 - title override
  • Loading branch information
SteveRyan-ASU authored Feb 11, 2025
2 parents 0386cc0 + 3e29a6a commit 5aa496c
Show file tree
Hide file tree
Showing 3 changed files with 49 additions and 3 deletions.
3 changes: 2 additions & 1 deletion acf-block-templates/profile-data/profile-data.php
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
$show_location = get_field( 'uds_profiledata_show_location' );
$show_social = get_field( 'uds_profiledata_show_social' );
$show_email = get_field( 'uds_profiledata_show_email' );
$title_override = get_field( 'uds_profiledata_title_override' );

/**
* Determine where to gather information about the profile.
Expand Down Expand Up @@ -120,7 +121,7 @@
} else {
$dept_override = false;
}
$profile .= pfpeople_card_displayname($asurite_details, $display_size, $dept_override);
$profile .= pfpeople_card_displayname($asurite_details, $display_size, $dept_override, $title_override);

/**
* All profile sizes render: image, name, title, department, and email when
Expand Down
41 changes: 40 additions & 1 deletion acf-json/group_63e3e25f75f79.json
Original file line number Diff line number Diff line change
Expand Up @@ -141,6 +141,45 @@
"ui_on_text": "Show",
"ui_off_text": "Hide",
"ui": 1
},
{
"key": "field_67a3d387067e0",
"label": "Title",
"name": "",
"aria-label": "",
"type": "accordion",
"instructions": "",
"required": 0,
"conditional_logic": 0,
"wrapper": {
"width": "",
"class": "",
"id": ""
},
"open": 0,
"multi_expand": 0,
"endpoint": 0
},
{
"key": "field_67a3df3d067e2",
"label": "Title Override",
"name": "uds_profiledata_title_override",
"aria-label": "",
"type": "text",
"instructions": "",
"required": 0,
"conditional_logic": 0,
"wrapper": {
"width": "",
"class": "",
"id": ""
},
"default_value": "",
"maxlength": "",
"allow_in_bindings": 0,
"placeholder": "",
"prepend": "",
"append": ""
}
],
"location": [
Expand All @@ -161,5 +200,5 @@
"active": true,
"description": "",
"show_in_rest": 0,
"modified": 1738691964
"modified": 1738794194
}
8 changes: 7 additions & 1 deletion inc/profile-data-functions.php
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ function pfpeople_disply_profile_image($data) {
* Build name, title and department strings.
* Include .person-name and .person-profession wrappers.
*/
function pfpeople_card_displayname($data, $display_size, $dept_override) {
function pfpeople_card_displayname($data, $display_size, $dept_override, $title_override) {

// Get the ASURITE fields from the data source.
$asurite = $data->asurite_id->raw;
Expand All @@ -62,9 +62,15 @@ function pfpeople_card_displayname($data, $display_size, $dept_override) {
if ( $dept_index ) {
$title = $data->titles->raw[$dept_index] ?? '';
$dept = $data->departments->raw[$dept_index] ?? '';
if ( ! empty( $title_override ) ) {
$title = $title_override;
}
} else {
$title = $data->working_title->raw[0] ?? '';
$dept = $data->primary_department->raw ?? '';
if ( ! empty( $title_override ) ) {
$title = $title_override;
}
}

$output = '';
Expand Down

0 comments on commit 5aa496c

Please sign in to comment.