2

I'm not sure if I'm only just noticing this error, or if it just came up from some reason...

EE v2.7.2
PT Field Pack v2.1.1

The Error:

A PHP Error was encountered
Severity: Notice
Message: Array to string conversion
Filename: fieldpack/ft.fieldpack_pill.php
Line Number: 132

If I comment out line 132 in fieldpack/ft.fieldpack_pill.php the error goes away, and the fieldtype seems to work just fine:

enter image description here

Any ideas what could be causing this? Is commenting the line out going to cause other problems?

2

I just had this issue too on same installation. I had installed a new fieldtype (Plate Picker), which uses the $settings['options'] array too to store the field_type settings. Problem is that P&T pill assumes all values inside $settings['options'] are string values, but with my new field_type they are not.

I didn't dig deeper into EE Fieldtypes to find out what's the default way to store field_type options, so I don't know exactly who should fix this.

Instead of completely commenting out the line, you should be able to fix this by adding an extra line of code on line 130:

foreach($settings['options'] as $name => $label)
{
    if (is_array($label)) continue; // Added

    if ($r !== '') $r .= "\n";
    $r .= $name;
    if ($name !== $label) $r .= ' : '.$label;
    if (isset($settings['default']) && $settings['default'] == $name) $r .= ' *';
}
2

Field Pack gives you the option to specify a name and value pair, so in your field you could set:

[value] : [name]

which might equate to say

1 : Yes
0 : No

This would then display in your pill field as a Yes/No button, but allow you to use the value instead of the name in your template logic. eg.

{if pill_field == '1'}

The code you've commented out looks like its doing some checking on your field values, and I think its saying if the name and label are not identical, return the data in the format

$name : $label

So to answer your question, commenting this line out probably will have an impact on how the field works.

We use the field pack a lot but haven't come across this. I'd say its less likely to be an issue in the ft.fieldpack_pill.php file though.

What have you set as the default values in the field?

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.