Thread

How to determine if a new fluid field is a fluid field in display_field

November 15, 2017 3:48pm

Subscribe [3]
  • #1 / Nov 15, 2017 3:48pm

    Reinos

    74 posts

    As the title say, how can i determine if I deal with a fluid field. Especially new fields, because on existing fields there is a variable available “$this->settings[‘fluid_field_data_id’]”.

  • #2 / Nov 15, 2017 4:07pm

    Kevin Cupp's avatar

    Kevin Cupp

    727 posts

    If you check $this->content_type(), does it return fluid_field?

  • #3 / Nov 15, 2017 4:14pm

    Reinos

    74 posts

    That returned channel inside the display_field() method

  • #4 / Nov 15, 2017 4:15pm

    Kevin Cupp's avatar

    Kevin Cupp

    727 posts

    Ah ok, I’m not sure we can change that either since Fluid technically works with Channel fields. Lemme volley this over to Seth.

  • #5 / Nov 15, 2017 4:26pm

    Seth Barber's avatar

    Seth Barber

    168 posts

    In system/ee/EllisLab/Addons/fluid_field/ft.fluid_field.php change lines 579 to 582 to just:

    $field->setItem('fluid_field_data_id', $fluid_field_data_id);

    Let me know if that works.

  • #6 / Nov 16, 2017 1:46pm

    Reinos

    74 posts

    Hi Seth,

    That does not work. On adding a new field the variable fluid_field_data_id still does not exists.

  • #7 / Nov 16, 2017 2:03pm

    Seth Barber's avatar

    Seth Barber

    168 posts

    It should exist, but be set to NULL. How are you testing it’s existence? You should be able to do array_key_exists('fluid_field_data_id', $this->settings).

  • #8 / Nov 16, 2017 2:03pm

    Seth Barber's avatar

    Seth Barber

    168 posts

    It should exist, but be set to NULL. How are you testing it’s existence? You should be able to do array_key_exists('fluid_field_data_id', $this->settings).

  • #9 / Nov 16, 2017 3:50pm

    Reinos

    74 posts

    Hi Seth,

    I test it now by just dumping var_dump($this->settings); the settings array. But with the possible fix you suggest, the key is not in the settings array. When the field exists, the key is in the settings table.

  • #10 / Nov 17, 2017 11:58am

    Seth Barber's avatar

    Seth Barber

    168 posts

    Try adding $f->setItem('fluid_field_data_id', NULL); at line 349 of system/ee/EllisLab/Addons/fluid_field/ft.fluid_field.php and see if that resolves it.

  • #11 / Nov 21, 2017 3:12pm

    Reinos

    74 posts

    Hi Seth,

    saw you pushed it already on the new build wink Also here the confirmation it worked!

ExpressionEngine News

#eecms, #events, #releases