Git Product home page Git Product logo

Comments (10)

patdunlavey avatar patdunlavey commented on June 11, 2024 1

👍 review on the PR. Thanks so much for your attention and effort to this @DiegoPino !!!

from webform_strawberryfield.

DiegoPino avatar DiegoPino commented on June 11, 2024

Hi, Good catch.
But happens that rdftype_family_name depends (in my silly brain) on using rdftype.

here:

if (($vocab_family_name == 'rdftype') && isset($element['#rdftype_family_name'])) {
$rdftype_family_name = trim($element['#rdftype_family_name']);
}

So if not using rdftype then we should disable the autocomplete right instead of forcing rdftype?

from webform_strawberryfield.

patdunlavey avatar patdunlavey commented on June 11, 2024

So here change it to

      elseif ($agent_type == 'family' && !empty($rdftype_family_name)) {

?

from webform_strawberryfield.

DiegoPino avatar DiegoPino commented on June 11, 2024

@patdunlavey maybe (most likely 😆 ) I did not understand the use case (yes, I got the error). Can you share the webform element config? Sorry I have too much code & devops today in my brain

from webform_strawberryfield.

DiegoPino avatar DiegoPino commented on June 11, 2024

Or the desired/expected functionality or a screenshot of the element configuration in the UI

from webform_strawberryfield.

patdunlavey avatar patdunlavey commented on June 11, 2024

Sorry for taking so long to respond. Lot of head-scratching here. I don't understand the config that causes this. I'm using an extended version of the WebformMultiAgent class, but all it does is add a few additional text fields; the configuration options are unchanged. I've been through my customized class with a fine-toothed comb and cannot see where it could be affecting this. But when I changed it to a standard WebformMultiAgent field, configured exactly the same (I just edited the webform source, changing #type to metadata_multiagent), I'm not seeing errors, and the autocomplete works fine. Here's the relevant part of the source:

  contributor_info:
    '#type': metadata_multiagent_acdc
    '#title': 'Contributor Info'
    '#multiple': true
    '#multiple__min_items': 0
    '#multiple__empty_items': 0
    '#multiple__add': false
    '#multiple__add_more_input': false
    '#agent_type__title_display': before
    '#vocab_personal_name': names
    '#vocab_corporate_name': names
    '#vocab_family_name': names
    '#role_type': loc

I'm not surprised that you haven't been able to reproduce this error because I haven't been able to either - except for the original one, which persists! So I don't know for sure that this is a bug in webform_strawberryfield\Element\WebformMultiAgent::processWebformComposite.

What I do know is that the existence of the variable $rdftype_family_name is not guaranteed when it reaches line 229, and when not present, it throws the errors I described. That, simply as a code review matter, seems like a good enough reason to me to either:

  1. Guarantee that $rdftype_family_name exists by setting it to a default value earlier in the code, or
  2. Test to see if it exists, and don't try to use it if it doesn't.

Much as I'd love to be able to provide guaranteed steps to reproduce the problem, that has evaded me. But I don't think that's an absolute requirement to address what, I think one can make a case for, is a code review issue?

I am able to make the white screen error go away by overriding the method in my class, by setting $autocomplete_label_default['rdftype'] = $autocomplete_label_default['rdftype'] ?? "FamilyName"; (this doesn't make the php warning go away, however). Or I can make my own patch to the webform_strawberryfield module. Obviously I'd rather do neither!

from webform_strawberryfield.

DiegoPino avatar DiegoPino commented on June 11, 2024

from webform_strawberryfield.

patdunlavey avatar patdunlavey commented on June 11, 2024

Thanks Diego. I DM'd you the two classes on slack.

from webform_strawberryfield.

DiegoPino avatar DiegoPino commented on June 11, 2024

from webform_strawberryfield.

DiegoPino avatar DiegoPino commented on June 11, 2024

Resolved via 1669a66

from webform_strawberryfield.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.