Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closes #2091, #1605, #1772 Add an optional thumbnail image field to AZ News, AZ Event #2308

Merged
merged 19 commits into from
May 12, 2023
Merged
Show file tree
Hide file tree
Changes from 17 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
langcode: en
status: true
dependencies:
module:
- node
id: node.az_card_alternate
label: 'Card Alternate'
targetEntityType: node
cache: true
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
langcode: en
status: true
dependencies:
module:
- node
id: node.field_az_featured_image_as_thumb
field_name: field_az_featured_image_as_thumb
entity_type: node
type: boolean
settings: { }
module: core
locked: false
cardinality: 1
translatable: true
indexes: { }
persist_with_no_fields: false
custom_storage: false
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
langcode: en
status: true
dependencies:
module:
- media
- node
id: node.field_az_media_thumbnail_image
field_name: field_az_media_thumbnail_image
entity_type: node
type: entity_reference
settings:
target_type: media
module: core
locked: false
cardinality: 1
translatable: true
indexes: { }
persist_with_no_fields: false
custom_storage: false
bberndt-uaz marked this conversation as resolved.
Show resolved Hide resolved
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
<?php

namespace Drupal\az_core\Plugin\migrate\process;

use Drupal\migrate\MigrateExecutableInterface;
use Drupal\migrate\ProcessPluginBase;
use Drupal\migrate\Row;

/**
* Converts a flat array to a nested array for use with sub_process.
*
* @MigrateProcessPlugin(
* id = "az_prepare_array_for_sub_process"
* )
*
* Available configuration keys:
* - source: A flat array of values.
*
* This plugin returns an array of associative arrays which have these
* key-value pairs:
* - "value" => (source array value)
* - "delta" => (incrementing index value)
*
* Example:
*
* @code
* process:
* multi_value_field:
* -
* plugin: az_prepare_array_for_sub_process
* source: flat_array
* -
* plugin: sub_process
* process:
* target_id: value
* delta: delta
* @endcode
*/
class PrepareArrayForSubProcess extends ProcessPluginBase {

/**
* {@inheritdoc}
*/
public function transform($value, MigrateExecutableInterface $migrate_executable, Row $row, $destination_property) {

$return_array = [];
if (!isset($value) || !is_array($value)) {
return $return_array;
}

$delta_value = 0;
foreach ($value as $array_element) {
$return_array[] = ['value' => $array_element, 'delta' => $delta_value];
$delta_value++;
}

return $return_array;
}

}
60 changes: 52 additions & 8 deletions modules/custom/az_demo/data/az_demo_event_node.json
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,8 @@
}
],
"az_photos" : "badwater_panorama.jpg",
"az_thumbnail" : "",
"az_featured_image_as_thumb" : "1",
"az_attachments" : "",
"az_attachments_description" : "",
"az_event_categories" : "Field Trip|Geology"
Expand All @@ -41,6 +43,8 @@
"uaqs_link_info" : "https://en.wikipedia.org/wiki/Pi_Day",
"uaqs_link_info_title" : "Information on Pi Day",
"az_photos" : "",
"az_thumbnail" : "",
"az_featured_image_as_thumb" : "1",
"az_attachments" : "pi.pdf|approximately.pdf",
"az_attachments_description" : "The symbol π.|The start of the decimal expansion of π.",
"az_event_categories" : "Special Event|Mathematics"
Expand All @@ -62,6 +66,8 @@
}
],
"az_photos" : "",
"az_thumbnail" : "",
"az_featured_image_as_thumb" : "1",
"az_attachments" : "",
"az_attachments_description" : "",
"az_event_categories" : "Lecture|Literature"
Expand All @@ -85,6 +91,8 @@
}
],
"az_photos" : "",
"az_thumbnail" : "",
"az_featured_image_as_thumb" : "1",
"az_attachments" : "",
"az_attachments_description" : "",
"az_event_categories" : ""
Expand All @@ -108,6 +116,8 @@
}
],
"az_photos" : "",
"az_thumbnail" : "",
"az_featured_image_as_thumb" : "1",
"az_attachments" : "",
"az_attachments_description" : "",
"az_event_categories" : "Course|Aerospace Engineering"
Expand All @@ -128,7 +138,9 @@
"title": ""
}
],
"az_photos" : "",
"az_photos" : "canyon_running.jpg",
"az_thumbnail" : "arizona_running.png",
"az_featured_image_as_thumb" : "0",
"az_attachments" : "",
"az_attachments_description" : "",
"az_event_categories" : "Training|Athletics"
Expand All @@ -148,7 +160,9 @@
"title": ""
}
],
"az_photos" : "",
"az_photos" : "earth_solid.jpg|earth_solid_2.jpg",
"az_thumbnail" : "",
"az_featured_image_as_thumb" : "1",
"az_attachments" : "",
"az_attachments_description" : "",
"az_event_categories" : "Lecture|Geology"
Expand All @@ -170,6 +184,8 @@
}
],
"az_photos" : "",
"az_thumbnail" : "",
"az_featured_image_as_thumb" : "1",
"az_attachments" : "",
"az_attachments_description" : "",
"az_event_categories" : "Course|Astronomy"
Expand All @@ -190,6 +206,8 @@
}
],
"az_photos" : "",
"az_thumbnail" : "europe_film.png",
"az_featured_image_as_thumb" : "0",
"az_attachments" : "",
"az_attachments_description" : "",
"az_event_categories" : "Film Screening|Film|Northern European Comedy Film Festival"
Expand All @@ -210,6 +228,8 @@
}
],
"az_photos" : "",
"az_thumbnail" : "europe_film.png",
"az_featured_image_as_thumb" : "0",
"az_attachments" : "",
"az_attachments_description" : "",
"az_event_categories" : "Film Screening|Film|Northern European Comedy Film Festival"
Expand All @@ -230,6 +250,8 @@
}
],
"az_photos" : "",
"az_thumbnail" : "europe_film.png",
"az_featured_image_as_thumb" : "0",
"az_attachments" : "",
"az_attachments_description" : "",
"az_event_categories" : "Film Screening|Film|Northern European Comedy Film Festival"
Expand All @@ -251,6 +273,8 @@
}
],
"az_photos" : "",
"az_thumbnail" : "",
"az_featured_image_as_thumb" : "1",
"az_attachments" : "",
"az_attachments_description" : "",
"az_event_categories" : "Course|Geology"
Expand All @@ -271,6 +295,8 @@
}
],
"az_photos" : "",
"az_thumbnail" : "",
"az_featured_image_as_thumb" : "1",
"az_attachments" : "",
"az_attachments_description" : "",
"az_event_categories" : "Special Event|Athletics|Physics"
Expand All @@ -292,12 +318,14 @@
}
],
"az_photos" : "",
"az_thumbnail" : "",
"az_featured_image_as_thumb" : "1",
"az_attachments" : "",
"az_attachments_description" : "",
"az_event_categories" : "Course|Geology"
},
{"id":15,
"title" : "The Basque minority in Nueva España",
"title" : "The Basque Minority in Nueva España",
"az_summary" : "",
"az_subheading" : "Basques in Nueva España",
"az_event_date" : "today + 2 weeks 17:00",
Expand All @@ -312,6 +340,8 @@
}
],
"az_photos" : "",
"az_thumbnail" : "",
"az_featured_image_as_thumb" : "1",
"az_attachments" : "",
"az_attachments_description" : "",
"az_event_categories" : "Lecture|History"
Expand All @@ -332,6 +362,8 @@
}
],
"az_photos" : "",
"az_thumbnail" : "",
"az_featured_image_as_thumb" : "1",
"az_attachments" : "",
"az_attachments_description" : "",
"az_event_categories" : "Lecture|History"
Expand All @@ -353,12 +385,14 @@
}
],
"az_photos" : "",
"az_thumbnail" : "",
"az_featured_image_as_thumb" : "1",
"az_attachments" : "",
"az_attachments_description" : "",
"az_event_categories" : "Course|Planetary Engineering"
},
{"id":18,
"title" : "GMOs: the New Ecoterrorist Hazard",
"title" : "GMOs: The New Ecoterrorist Hazard",
"az_summary" : "",
"az_subheading" : "Ecoterrorists embrace GMOs",
"az_event_date" : "today + 10 days 12:00",
Expand All @@ -372,7 +406,9 @@
"title": ""
}
],
"az_photos" : "",
"az_photos" : "gmo.jpg",
"az_thumbnail" : "",
"az_featured_image_as_thumb" : "1",
"az_attachments" : "",
"az_attachments_description" : "",
"az_event_categories" : "Lecture|Security|Environmental Science"
Expand All @@ -388,11 +424,13 @@
"az_body" : "In addition to the Latin, Spanish and Portugese texts, Baroque composers in the New World turned to indigenous langages for their vocal settings. This concert features “Xicochi, xicochi, conetzintle” (by Gaspar Fernandez, in Nahuatl), “Hanacpachap cuisscuinin” (by Juan Pérez Bocanegra, in Quecha) and many more.",
"az_location": [
{
"url": "http://directory.arizona.edu/buildings/holsclaw-hall",
"url": "https://music.arizona.edu/facilities/concert-halls/",
"title": "Holsclaw Hall"
}
],
"az_photos" : "",
"az_photos" : "holsclaw_hall.jpg",
"az_thumbnail" : "holsclaw_hall.jpg",
"az_featured_image_as_thumb" : "1",
"az_attachments" : "",
"az_attachments_description" : "",
"az_event_categories" : "Concert|Music"
Expand All @@ -414,6 +452,8 @@
}
],
"az_photos" : "",
"az_thumbnail" : "",
"az_featured_image_as_thumb" : "1",
"az_attachments" : "",
"az_attachments_description" : "",
"az_event_categories" : "Course|Planetary Engineering"
Expand All @@ -433,7 +473,9 @@
"title": ""
}
],
"az_photos" : "",
"az_photos" : "pumpelly_arizona.jpg",
"az_thumbnail" : "",
"az_featured_image_as_thumb" : "1",
"az_attachments" : "",
"az_attachments_description" : "",
"az_event_categories" : "Lecture|History|Geology"
Expand All @@ -454,6 +496,8 @@
}
],
"az_photos" : "",
"az_thumbnail" : "",
"az_featured_image_as_thumb" : "1",
"az_attachments" : "",
"az_attachments_description" : "",
"az_event_categories" : "Lecture|Music|Mathematics"
Expand Down
45 changes: 45 additions & 0 deletions modules/custom/az_demo/data/az_demo_image_file.json
Original file line number Diff line number Diff line change
Expand Up @@ -91,6 +91,11 @@
"alt" : "Woman running",
"title": ""
},
{
"filename" : "runners_brains_2.jpg",
"alt" : "Man running",
"title": ""
},
{
"filename" : "mans_best_friend.jpeg",
"alt" : "Cute dog",
Expand All @@ -106,6 +111,46 @@
"filename" : "The_Hay_Wain_by_Hieronymus_Bosch.jpeg",
"alt" : "The Hay Wain by Hieronymus Bosch",
"title": ""
},
{
"filename" : "arizona_running.png",
"alt" : "Arizona running logo",
"title": ""
},
{
"filename" : "canyon_running.jpg",
"alt" : "Woman running in a canyon",
"title": ""
},
{
"filename" : "earth_solid.jpg",
"alt" : "A volcanic crater",
"title": ""
},
{
"filename" : "earth_solid_2.jpg",
"alt" : "A mountain range with a river of lava",
"title": ""
},
{
"filename" : "pumpelly_arizona.jpg",
"alt" : "Map of Arizona from 1878",
"title": ""
},
{
"filename" : "europe_film.png",
"alt" : "Northern European film festival logo",
"title": ""
},
{
"filename" : "holsclaw_hall.jpg",
"alt" : "Holsclaw Hall",
"title": ""
},
{
"filename" : "gmo.jpg",
"alt" : "Concept of research on genetic modification of food",
"title": ""
}
]
}
Expand Down
Loading