Jump to content

JsonNativeField: key-value table + native JSON = fully searchable


BitPoet

Recommended Posts

On 8/20/2021 at 5:43 PM, Ivan Gretsky said:

2. This doesn't seem to work. I get an error Call to a member function set() on string. Am I doing something wrong?

There's a typo there, it should be "->" instead of ">-", sorry for that.

On 8/20/2021 at 5:43 PM, Ivan Gretsky said:

3. You gave example of how to set new values. Can you help with getting the value of a specified key and outputting it.

<?php

// Expressive version:
echo $p->nativeField->get('fifth-row')->value;

// If the native field's name adheres to PW's field name rules, you can shorten that:
echo $p->nativeField->fifthrow->value;

// Stringification returns the stringified value, not the object
echo "{$p->nativeField->fifthrow}";

 

On 8/20/2021 at 5:43 PM, Ivan Gretsky said:

5. What are field type configuration options? Are you talking about setting a new custom type (for example, not just text, but email / phone) with its own customizable pattern checks and so on? That was exactly what I was about to propose. The other cool thing would be to use custom inputfields for types. Like Page Reference to get a comma separated pages list and store it as a string.

That would be another step further. For now, it's just configuration options for each different kind of input (text, int, float...).

On 8/20/2021 at 5:43 PM, Ivan Gretsky said:

6. Another idea is the ability to limit the names and/or name/type combinations to a predefined set, so the user can only choose from the list, but not create new key/value pairs.

I'm not sure if that would offer much advantage over regular fields, but I'll give it some thought.

  • Like 1
Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...