-
Notifications
You must be signed in to change notification settings - Fork 118
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
added tokens to handle islandora > media operation #836
added tokens to handle islandora > media operation #836
Conversation
I can test this now |
I can confirm that this works through the UI. I set my description metatag to When playing wtih it via drush (which is foolishly what I did first), I ran into this:
Admittedly this probably isn't that big of a deal. Just reporting it because I bumped into it. |
islandora.tokens.inc
Outdated
* @return mixed | ||
* \Drupal\file\FileInterface on success, NULL otherwise. | ||
*/ | ||
function controlled_access_terms_image_from_media($media) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Probably can ditch this for the MediaSourceService, but if not, you'd wanna rename it :)
Testing again @wgilling |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The error I was getting in Drush is gone. Thx @wgilling. There's two small things to touch up and I'm happy to merge this in.
islandora.tokens.inc
Outdated
$replacements = []; | ||
if ($type == 'islandoratokens' && !empty($data['node'])) { | ||
if (!is_array($tokens) || empty($tokens)) { | ||
\Drupal::logger('controlled_access_terms') |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
controlled_access_terms
should be islandora
here.
islandora.tokens.inc
Outdated
// Is there media? | ||
// @todo: is this single or multiple? | ||
if ($media) { | ||
$file = controlled_access_terms_image_from_media($media); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You can replace this with
$file = \Drupal::service('islandora.media_source_service')->getSourceFile($media);
and delete the controlled_access_terms_image_from_media
function altogether.
… removed the controlled_access_terms_image_from_media method
ok - as per the most recent two requested changes, I pushed a commit to update the logger type and replace the controlled_access_terms_image_from_media method call (as well as remove that method's code). |
@dannylamb -- is there something that is still not addressed for this? |
spinning this up again 🚀 |
Tested again and the token's are replacing fine 🚀
|
that should do it @dannylamb ... it's been a pleasure. |
@dannylamb can this be merged? |
Yes, yes it can. Thanks for the nudge. This was one I was really hoping to get in for the release. I'll add an entry for it in our test case spreadsheet and go through the motions again after merging. |
Thanks for all your work on this @wgilling , this opens up a lot of new ground for us. |
This adds the two tokens that relate to media from the previously created "islandora_tokens" made by @kayakr
JIRA Ticket: Islandora/documentation#1171
The other part of the tokens (that was in the "ASU islandora_tokens" module) have been moved into a pull request on the
controlled_access_terms
module.What does this Pull Request do?
Adds two tokens (well four if you count the deprecated aliases) that can output a Repository Item's media field_media_image value by using one of the tokens like "media-thumbnail-image:alt" and "media-thumbnail-image:url", or "media_thumbnail_image:alt" and "media_thumbnail_image:url"
A brief description of what the intended result of the PR will be and/or what problem it solves.
Anywhere tokens may be used in Drupal, this allows the output of a Repository Item's media field_media_image value
How should this be tested?
From the Metatag settings interface, adjust the configuration for a "Repository item" to add a field value that uses one of the new tokens. Save config.
Refresh the page for any Repository item that does have media and inspect the section to see if the new value is represented.
Additional Notes:
This branch and the identically named branch on
controlled_access_terms
together represent the entire set of tokens that were made in two separateislandora_tokens
modules that were simultaneously invented for slightly different needs. The ASU one was mostly for populating the Google Scholar metatags.Interested parties
@dannylamb, @Islandora/8-x-committers, @kayakr