We use cookies to improve your experience. No personal information is gathered and we don't serve ads. Cookies Policy.

ExpressionEngine Logo ExpressionEngine
Features Pricing Support Find A Developer
Partners Upgrades
Blog Add-Ons Learn
Docs Forums University
Log In or Sign Up
Log In Sign Up
ExpressionEngine Logo
Features Pro new Support Find A Developer
Partners Upgrades
Blog Add-Ons Learn
Docs Forums University Blog
  • Home
  • Forums

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

Developer Preview

Reinos's avatar
Reinos
79 posts
7 years ago
Reinos's avatar Reinos

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’]”.

       
Kevin Cupp's avatar
Kevin Cupp
791 posts
7 years ago
Kevin Cupp's avatar Kevin Cupp

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

       
Reinos's avatar
Reinos
79 posts
7 years ago
Reinos's avatar Reinos

That returned channel inside the display_field() method

       
Kevin Cupp's avatar
Kevin Cupp
791 posts
7 years ago
Kevin Cupp's avatar Kevin Cupp

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

       
Seth Barber's avatar
Seth Barber
172 posts
7 years ago
Seth Barber's avatar Seth Barber

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.

       
Reinos's avatar
Reinos
79 posts
7 years ago
Reinos's avatar Reinos

Hi Seth,

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

       
Seth Barber's avatar
Seth Barber
172 posts
7 years ago
Seth Barber's avatar Seth Barber

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).

       
Seth Barber's avatar
Seth Barber
172 posts
7 years ago
Seth Barber's avatar Seth Barber

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).

       
Reinos's avatar
Reinos
79 posts
7 years ago
Reinos's avatar Reinos

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.

       
Seth Barber's avatar
Seth Barber
172 posts
7 years ago
Seth Barber's avatar Seth Barber

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.

       
Reinos's avatar
Reinos
79 posts
7 years ago
Reinos's avatar Reinos

Hi Seth,

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

       

Reply

Sign In To Reply

ExpressionEngine Home Features Pro Contact Version Support
Learn Docs University Forums
Resources Support Add-Ons Partners Blog
Privacy Terms Trademark Use License

Packet Tide owns and develops ExpressionEngine. © Packet Tide, All Rights Reserved.