Closed (fixed)
Project:
Media Entity Facebook
Version:
8.x-2.x-dev
Component:
Code
Priority:
Normal
Category:
Task
Assigned:
Reporter:
Created:
12 Apr 2017 at 12:10 UTC
Updated:
5 Oct 2017 at 18:25 UTC
Jump to comment: Most recent, Most recent file
Comments
Comment #2
naveenvalechaMoving to correct branch.
Comment #3
naveenvalechaInitial Port with patch #2831274-363: Bring Media entity module to core as Media module
Could use some reviews :)
//Naveen
Comment #4
naveenvalechaComment #5
seanbThanks for working on this! Looking good! Besides the review, I noticed the following would be nice for the module (out of scope for this issue though):
Basic review (I didn't actually install, but this is what I found at first glance):
Probably good to copy hook_requirements as well.
Need to fix this in the formatter:
You still need to rename getFields() to getMetadata to provide values for the metadata attributes.
Comment #6
naveenvalechaThanks, Sean! Assigning to myself for addressing the #5 review.
Added a follow-up for Add Default config providing a media type and provide Tests #2869286: Add Default config providing a media type and provide Tests
//Naveen
Comment #7
naveenvalechaComment #8
naveenvalechaHere's the patch which addressed the following:
//Naveen
Comment #9
naveenvalechaHere's the correct patch and inter diff.
Comment #10
seanbI'm sorry,
getFields()was supposed to begetField(). This method needs to be renamed togetMetadata().Comment #11
naveenvalecha#10,
getField was not in the head itself.Probably there was nowhere it displayed the field/metadata information. Filed a followup issue to fix in the head #2869286: Add Default config providing a media type and provide Tests because there could be some test case where the metadata would be required.
//Naveen
Comment #12
naveenvalechaThanks for the reviews. here's the updated patch where I fixed more findings.
//Naveen
Comment #13
naveenvalechaIf the module does not define the media source config schema it throws the WSOD. However, it seems an edge case and module should define the metadata which was missing in the case of media_entity_facebook
Below is the error with backtrace for log.
//Naveen
Comment #14
naveenvalechaHere's the updated patch with more changes. I'm getting this error while saving the facebook media item. Debugging this further. Moving to N/W due to below issue
//Naveen
Comment #15
naveenvalechaComment #16
marcoscanoNice work!
I'm starting to port another plugins as well, and wanted to make sure we are more or less in sync. Here are the doubts I had while reviewing this patch:
Shouldn't this be uncommented?
Shouldn't this be
$destination = \Drupal::config('media.settings')->get('icon_base_uri');?Shouldn't
$source->getMetadata()be used instead of->getField()?Minor: unnecessary trailing comma?
Shouldn't we include here the two new metadata fields defined in the base class method as well? Something like:
Comment #17
naveenvalechaP.S.: I have tested the code and it is breaking while saving the new entity. I'll get back to this issue tomorrow if you want me to beat it go ahead.
Steps for testing:
1) Go to the media/add/facebook
2) Save any facebook media
3) BUMP WSOD SQL exception error due to the thumbnail_uri
Reason:
In the presave of the Media entity, the media item is updating the thumnail using updateThumbnail but it is failed to get the thumnail_uri from the getThumbnailUri method. Below is the getThumbnailUri method of Media class.
Condition:
1) Entity is new
2) Queue thumbnail downloads is not enabled
3) It is going into the else condition, where it is trying to get the thumnail_uri from the thumbnail_uri Annotation metadata which is not set(Actually is not required). The default_thumbnail_filename attribute is set in the Facebook Media source annotation.
Consensus: It should come in the first condition.
Next Steps:
File a new issue.
Write a Test to prove that this is failing.
Post a patch
Setting it to Needs Review to see how many other tests are failing :) Go testbot go!
//Naveen
Comment #18
naveenvalechaHere are the patch files for #16
//Naveen
Comment #19
seanbThe
getMetadata()method doesn't call it's parent if no metadata was found. InMediaSourceBasea default thumbnail is returned for thethumbnail_uriattribute. I think if you add the code below to the switch statement it should already be fixed.Comment #20
naveenvalechaHere we go. Addressed above issue in #17.
//Naveen
Comment #21
bkosborneHere's a re-roll since I recently did some refactoring.
Comment #22
bkosborneAnd after testing, here's some fixes.
One thing I couldn't figure out how to do is to automatically set the proper field formatter to the one provided by this module when the field config is created. That would be great for the out of box experience. Otherwise now users have to edit the media entity display settings and manually change the formatter.
Comment #24
bkosborneCommitted. Thanks for all the work everyone! Feel free to create follow ups for the 2.x branch. I'll update project homepage to indicate 2.x branch is compatible with media in core.