ExpressionEngine-User-Guide icon indicating copy to clipboard operation
ExpressionEngine-User-Guide copied to clipboard

Fluid Fieldtype Development - `dislpay_settings()` v.s. `grid_display_settings()` return data format

Open RK311y opened this issue 1 year ago • 0 comments

Suggested Change

To display settings for field types that support grid content types, the array returned from display_settings() method is a bit different.

Example: The relationship field makes this distinction by checking for the parent content type within the display_settings() method routine. See here: https://github.com/ExpressionEngine/ExpressionEngine/blob/61e559413f40324d888ff9ebf4f43dc5f74e8ea1/system/ee/ExpressionEngine/Addons/relationship/ft.relationship.php#L789-L797

Standard Channel Field display_settings()


$settings = array(
    // some SharedForm field settings
);

// return settings for standard channel field
return array('field_options_custom_field' => array(
      'label' => 'field_options',
      'group' => 'custom_field',
      'settings' => $settings
  ));

Fluid Field display_settings()


$settings = array(
    // some SharedForm field settings
);

// return settings for standard channel field
if ($this->content_type() == 'grid') {
    return array('field_options' => $settings);
}

NOTE: this should also be the format for data returned from grid_display_settings()

Reasoning

The documentation for Fluid Fieldtype Development does not explain this.

Additional context

@intoeetive I tried to look and see if this documentation already existed, but I do not believe that it does. If I missed it, please let me know!

RK311y avatar Jul 29 '23 20:07 RK311y