Support » Plugin: Pods - Custom Content Types and Fields » Fields variables documentation

  • Resolved Fiable.biz

    (@fiablebiz)


    Hello.

    I’m new to Pods, I’ve never coded for WordPress, and I’m trying to add a “legal numbering” field type to Pods. Legal numbers are things like “2.13.1.7”, “553-2-12” or “L221-1-3”, which is trickier because it is country-dependent (in France, within a legal code, “L” indicates a “law” clause, which should appear before the clause of an “arrêté ministériel” (ministerial decree), whose number begins with “A”, but in the alphabetical order, “A” comes before “L”.). The need is to sort clauses automatically thanks to their number. For this purpose, I’m trying to mimic classes/fields/number.php (or would text.php be a better start?).
    My question may be stupid but where are the variables documented? For instance, where can I understand what is “boolean_yes_label”?

Viewing 3 replies - 1 through 3 (of 3 total)
  • Plugin Author Jory Hogeveen

    (@keraweb)

    Hello @fiablebiz

    The exact field variables (options) aren’t really documented that well as these are mostly used internally.

    Since your values contain letter as well you’ll have to use the text field, not a number.
    For sorting you can use the orderby params (available in both Pods::find and WP_Query).

    Cheers, Jory

    Fiable.biz

    (@fiablebiz)

    Thank you. If field variables are not “really documented that well”, are there documented at all? Second question: is there anywhere an introduction to Pods code, or/and a guideline for contributions to the code?

    Plugin Author Scott Kingsley Clark

    (@sc0ttkclark)

    I would start with a text field. Are you asking about custom validation for this? I wouldn’t go totally into a brand new field type, if you need to customize you probably could do it with a custom hook.

    As for the field type option documentation, they’re all documented per field type in the code in the options() method:

    https://github.com/pods-framework/pods/blob/main/classes/fields/text.php#L39

    The validation can be hooked into the filter pods_field_{$type}_validate:

    https://github.com/pods-framework/pods/blob/main/classes/PodsForm.php#L1180

Viewing 3 replies - 1 through 3 (of 3 total)
  • You must be logged in to reply to this topic.