rica-carv / links_page

Links page plugin for e107 V2
0 stars 0 forks source link

open type dropdown is empty #6

Open Jimmi08 opened 6 years ago

Jimmi08 commented 6 years ago

I am not able to add link image

Only diff between working version is using php 7.2

Jimmi08 commented 6 years ago

Prefs are correct: image

Jimmi08 commented 6 years ago
        $this->prefs['link_open_all']['writeParms']['optArray'] = array(
      '5'=>LCLAN_OPT_42,
      '0'=>LCLAN_ITEM_17,
      '1'=>LCLAN_ITEM_18,
      '4'=>LCLAN_ITEM_19
      );

I don't see any diff:

        $this->fields['link_open']['writeParms']['optArray'] = array(
      '0'=>LCLAN_ITEM_17,
      '1'=>LCLAN_ITEM_18,
      '4'=>LCLAN_ITEM_19
      );
Jimmi08 commented 6 years ago

Confirmed, problem in 7.1 too, changing to 7.0 solved issue.

rica-carv commented 6 years ago

So it is a php code issue. I haven't got yet a test environment set for 7.x, since i currently still need 5.4 support....

But it's currently working with PHP 5.4.45: untitled 1

Thanks

Jimmi08 commented 6 years ago

I have it worked with 7.0, it is not related to this plugin, it's core thing.

rica-carv commented 6 years ago

That was my second choice to investigate.....

Thanks

SimSync commented 6 years ago

@Jimmi08 @rica-carv Are you sure with the the ['optArray'] key?

I know this only without...?!? So i would write it like this: $this->fields['link_open']['writeParms'] = array( '0'=>LCLAN_ITEM_17, '1'=>LCLAN_ITEM_18, '4'=>LCLAN_ITEM_19 );

Jimmi08 commented 6 years ago

@SimSync I am sure it's correct way. There was issue - your solution didn't work and this was fix by CaMeRon. And it works in PHP 5.4, 5.5, 5.6, 7.0, so it's has something with php compability, if it doesn't work in 7.1 and 7.2

And I just look at plugin that CaMeRon helped me with: $this->fields['element_type_id']['writeParms']['optArray'] = $categories; // in case you want to add other parms? there is ['optArray'] too.

SimSync commented 6 years ago

@Jimmi08 Yes, you are right. Just checked in the source. How is the "writeParms" initialized in the field definition? This way: 'writeParms'=>array() or 'writeParms'=>"" or something different? Try initializing writeParms with array().