Comments

drunken monkey created an issue. See original summary.

drunken monkey’s picture

Issue tags: +beta blocker
Saphyel’s picture

Assigned: Unassigned » Saphyel
Issue tags: +DevDaysMilan
Saphyel’s picture

Assigned: Saphyel » Unassigned
Status: Active » Needs review
StatusFileSize
new698 bytes

Status: Needs review » Needs work

The last submitted patch, 4: 2644502-4.patch, failed testing.

The last submitted patch, 4: 2644502-4.patch, failed testing.

drunken monkey’s picture

Thanks for your work!

There are some issues with your patch, though:

  1. +++ b/src/Utility.php
    @@ -68,9 +68,11 @@ public static function isTextType($type, array $text_types = array('text')) {
    +    $default = in_array($type, $text_types);
    +    $fallback = in_array($type->getFallbackType(), $text_types);
    +    return ($default || $fallback) ? TRUE : FALSE;
    

    I would return early in case the first check works out. Also, you should only check the fallback type if !$type->isDefault().
    Mostly, though, $type is a string at this point. You'll first need to load the appropriate data type plugin for this to work.

  2. +++ b/src/Utility.php
    @@ -68,9 +68,11 @@ public static function isTextType($type, array $text_types = array('text')) {
    +    return ($default || $fallback) ? TRUE : FALSE;
    

    The condition already produces a boolean, the trinary operator serves no purpose there.

  3. +++ b/src/Utility.php
    @@ -68,9 +68,11 @@ public static function isTextType($type, array $text_types = array('text')) {
    -
    +
    

    What is this change?
    Might be the reason the patch fails to apply.

Also, if we fix this, we can remove the @todo comment in that method. (Speaking of which – that comment moved yesterday, so maybe that's the reason the patch won't apply. Please use the very latest dev version!)

Saphyel’s picture

Status: Needs work » Needs review
StatusFileSize
new2.4 KB

I think I used the lastest dev version, git at least says the commit id 270a742918a02fd86808757af551a64a1af2e1c4 from yesterday.
I don't understand your 3rd point, maybe your browser show you something wrong ? My patch doesn't change that line and the comments are still there...

Saphyel’s picture

StatusFileSize
new694 bytes

Sorry wrong patch :(

Status: Needs review » Needs work

The last submitted patch, 9: add_a_fallback_type-2644502-9.patch, failed testing.

The last submitted patch, 9: add_a_fallback_type-2644502-9.patch, failed testing.

ndrake86’s picture

Status: Needs work » Needs review
StatusFileSize
new14.3 KB

First attempt at address #1 in comment #7 with isTextType expecting a FieldInterface instead of as string.
Probably a much easier way but thought I would give it a shot.

Status: Needs review » Needs work

The last submitted patch, 12: add_a_fallback_type_for_custom_fields-2644502-12.patch, failed testing.

The last submitted patch, 12: add_a_fallback_type_for_custom_fields-2644502-12.patch, failed testing.

ndrake86’s picture

StatusFileSize
new15.89 KB

Second go at this. Handling special fields problem.

ndrake86’s picture

Status: Needs work » Needs review

Status: Needs review » Needs work

The last submitted patch, 15: add_a_fallback_type_for_custom_fields-2644502-15.patch, failed testing.

The last submitted patch, 15: add_a_fallback_type_for_custom_fields-2644502-15.patch, failed testing.

ndrake86’s picture

Status: Needs work » Needs review
StatusFileSize
new945 bytes

I think I went the completely wrong direction with what I was trying to accomplish. I think this is a better patch.

Status: Needs review » Needs work

The last submitted patch, 19: add_a_fallback_type_for_custom_fields-2644502-19.patch, failed testing.

The last submitted patch, 19: add_a_fallback_type_for_custom_fields-2644502-19.patch, failed testing.

drunken monkey’s picture

Yes, this looks a lot better, thanks a lot!
Except that you can just use $manager->createInstance() instead of iterating over all instances (which we might want to override to add caching, come to think of it) this already looks like the correct solution. We'll just have to fix the test cases to add a mockup of the plugin manager in a container. (See, e.g., our EntitySerializationTest for an example of adding mockup services.)

ndrake86’s picture

Status: Needs work » Needs review
StatusFileSize
new825 bytes

@druken monkey, updated patch per your comment in #22.

Thanks for the reply and hopefully this helps.

Status: Needs review » Needs work

The last submitted patch, 23: add_a_fallback_type_for_custom_fields-2644502-23.patch, failed testing.

The last submitted patch, 23: add_a_fallback_type_for_custom_fields-2644502-23.patch, failed testing.

ndrake86’s picture

StatusFileSize
new868 bytes

Failed cause of null $data_type. Don't quite know where that is possible but added isset check before that operation.

ndrake86’s picture

Status: Needs work » Needs review

Status: Needs review » Needs work

The last submitted patch, 26: add_a_fallback_type_for_custom_fields-2644502-26.patch, failed testing.

The last submitted patch, 26: add_a_fallback_type_for_custom_fields-2644502-26.patch, failed testing.

drunken monkey’s picture

Status: Needs work » Needs review
StatusFileSize
new3.56 KB
new3.53 KB

Thanks, great work!
I just reformatted according to my preferences, but your version was completely correct. Thanks again!
The attached patch also contains the discussed caching and should fix the reported test fails. (I get some more fails now, but want to make sure the test bot sees them, too, before working on them.)

Status: Needs review » Needs work

The last submitted patch, 30: 2644502-30.patch, failed testing.

drunken monkey’s picture

Status: Needs work » Needs review
StatusFileSize
new2.66 KB
new5.77 KB
drunken monkey’s picture

StatusFileSize
new500 bytes
new5.8 KB

I'm not very good at this.

ndrake86’s picture

@drunken monkey I will pull the patch and test it out. Thanks for getting this all in.

ndrake86’s picture

Status: Needs review » Reviewed & tested by the community

@Drunken Monkey. Tested with a custom field type and everything is working from what I have tested.

Thanks,

Nick

borisson_’s picture

drunken monkey’s picture

Status: Reviewed & tested by the community » Fixed

Committed.
Thanks again for your work on this, everyone!

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.