9

Just upgraded from 2.5.5 to 2.7 Not a smooth upgrade as it whitescreened - when I turned errors on it gave me this:

Fatal error: Class PT_Fieldtype contains 1 abstract method and must therefore be declared abstract or implement the remaining methods (EE_Fieldtype::display_field) in /home/foobar/public_html/foobar/system/expressionengine/third_party/pt_field_pack/pt_fieldtype.php on line 148

Yes it was still running the old field pack but by then I'd not upgraded any third party modules yet.

I'm still running PHP 5.2.15 incase that matters here. Clues?

Thanks John

edit: I've just rolled back to 2.5.5 (and 2.7 failed again) but I can report that my P&T fieldtypes are 1.0.3

4 Answers 4

12

Grab the latest P&T Field Pack. They fixed it recently.

1
  • 2
    ...and delete the old pt_* folders in system/expressionengine/third_party to make the errors go away. Sounds scary, but no data is harmed (confirmed by P&T docs).
    – Matt Stein
    Commented Feb 25, 2014 at 22:55
12

In EE 2.7, each class extending EE_Fieldtype is required to implement a display_field() function.

So either you implement that function with no actual implementation if you just want the error to go away

public function display_field($data)
{
 // NOTE: Placeholder
}

or wait for the fieldtype developers to implement the function so as to be compatible to the new EE version.

3
  • 1
    I updated to EE 2.7.2 today and this answer proves to be a critical. Without silencing the error by adding this function one is not able to carry on with the migration of P&T Field Pack to Field Pack. Thanks arvinsim!
    – Alex Kendrick
    Commented Oct 24, 2013 at 21:50
  • Very helpful thanks, ran into this issue today, even with the latest version of the fieldpack. Commented Oct 31, 2013 at 12:01
  • Reiterating — without this answer I was totally stuck. Thank you!
    – Tim
    Commented Nov 16, 2013 at 4:28
7

Here's how to upgrade an existing EE install with P&T fieldtypes.

After upgrading EE you'll get this error when visiting the modules section:

Fatal error: Class PT_Fieldtype contains 1 abstract method and must therefore be declared abstract or implement the remaining methods (EE_Fieldtype::display_field) in /third_party/pt_field_pack/pt_fieldtype.php on line 148

To fix:

  1. Download the latest fieldpack and copy the files into your install
  2. Add this code to /third_party/pt_field_pack/pt_fieldtype.php (just below the constructor):

    public function display_field($data) {}
    
  3. Navigate to Addons -> Fieldtypes and install all of the new fieldtypes (the ones that start with FieldPack - blabla. Doing this will automatically uninstall the old fieldtype and change the existing fields you have to use the new fieldtype.

  4. Delete the old fieldtype files (ie. rm -rf third_party/pt_* + webroot/themes/third_party/pt_*)

Voilà - finished!

1
  • 1
    As a side note, for anyone else coming to this who doesn't know what a constructor is (like me), place the above code on line 148 after the }.
    – ralph.m
    Commented May 13, 2014 at 2:18
3

P&T Field Pack has been renamed into/superseded by Field Pack.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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