Search

In older versions, Symphony required fields class names to resemble the field file name: a field named “field.example.php” had to contain a class “fieldExample” in order to work. It didn’t matter how the extension itself was named, e. g. “my-example”.

Symphony 2.2 seems to require field classes to match field file names to match extension folder names. So the extension “my-example” now requires “field.my-example.php” and “fieldMy-example”.

Bug or feature?

I would hope it’s a bug, as what happens if you have two fields in your extension? It would fail, yes? You can’t call two fields the same name?!

Consistency, however is needed for this sort of thing…

So the extension “my-example” now requires “field.my-example.php” and “fieldMy-example”

I think I understand what you’re saying. You mean that if an extension “My Extension” provides a field, it has to be a class fieldMyExtension in a file field.my_extension.php and that it can not provide a field called “My Field” (fieldMyField in a file field.my_field.php)?

I’m sure I’ve seen extensions provide more than one field, but perhaps there is a requirement that at least one of the fields matches the extension name. The beta Members extension doesn’t limit itself to the above conditions. Are you seeing this just in Symphony 2.2?

Yesterday, I just updated my private website from Symphony 2.0 to Symphony 2.2RC2 locally and I noticed that my Output Field extension stopped working. The extension name is output_field whereas the field itself is called field.output.php containing a class fieldOutput (it is extending the default field.input.php so this really makes sense). Symphony broke saying it couldn’t find the field output_field at /extensions/output_field/field/.

In my opinion it makes sense to have different names for extensions and fields so I don’t understand this limitation. It seems to be caused by this line in class.fieldmanager.php: https://github.com/symphonycms/symphony-2/blob/integration/symphony/lib/toolkit/class.fieldmanager.php#L70. The function in Symphony 2.1 was as simple as this: https://github.com/symphonycms/symphony-2/blob/master/symphony/lib/toolkit/class.fieldmanager.php#L37

So in older Symphony version, the system checked for the field type/name (which is just output in my case) and didn’t try to compare this with the extension name.

I agree, I don’t think this should be a limitation. Your extension might be named one thing, and your field another, so they shouldn’t be linked.

While investigating I noticed that it’s also possible the code in class.fieldmanager.php actually works, but that the create function is passed a wrong $type. The problem occurs when accessing the section editor:

Could not find Field output_field at /field.output_field.php. If the Field was provided by an Extension, ensure that it is installed, and enabled.
/Users/nilshoerrmann/Sites/Webseiten/nilshoerrmann.de/symphony/lib/toolkit/class.fieldmanager.php line 342

337         if(!isset(self::$_pool[$type])){
338             $classname = $this->__getClassName($type);
339             $path = $this->__getDriverPath($type);
340
341             if(!file_exists($path)){
342                 throw new Exception(
343                     __(
344                         'Could not find Field %1$s at %2$s. If the Field was provided by an Extension, ensure that it is installed, and enabled.',
345                         array($type, $path)
346                     )

Now I’m feeling stupid:

I tracked this down and it seems like something has got messed up in my database during the update from Symphony 2.0 to 2.2 and all the extension updating. My database contained a wrong field type (output_field instead of output) which was used during field initialisation.

Changing this value solves the “issue”.
I’m really sorry!

I was able to replicate this though…

In my Search Index extension I changed the name of the field file to field.search_index_filter.php (from field.search_index.php) and also changed the class name accordingly. When I went to create a new section I got an error:

Could not find Field searchindex at /field.searchindex.php. If the Field was provided by an Extension, ensure that it is installed, and enabled.

I don’t want my field to be named the same as my extension.

I think this has to do with other section already containing your field, which have stored your original name inside sym_fields. Does this also happen when your field is not attached to any other section before changing the name?

You are right. I had renamed my field before uninstalling the extension. So it allowed me to uninstall the extension without error (because it didn’t know about the field with the old name being left in a section), and when I went to revisit the section editor it couldn’t find the field driver for the old name. However if I remove all instances of the old field and re-enable the extension, I can confirm that you can indeed have an extension with one name, and a field of another name.

False alarm!

It seems to be caused by this line in class.fieldmanager.php: https://github.com/symphonycms/symphony-2/blob/integration/symphony/lib/toolkit/class.fieldmanager.php#L70. The function in Symphony 2.1 was as simple as this: https://github.com/symphonycms/symphony-2/blob/master/symphony/lib/toolkit/class.fieldmanager.php#L37

Just to comment on this. The complexity is exactly the same, the __find function was never used outside of this context, so I just copied the logic into the __getClassPath function to save having a function that really didn’t do a lot :)

Create an account or sign in to comment.

Symphony • Open Source XSLT CMS

Server Requirements

  • PHP 5.3-5.6 or 7.0-7.3
  • PHP's LibXML module, with the XSLT extension enabled (--with-xsl)
  • MySQL 5.5 or above
  • An Apache or Litespeed webserver
  • Apache's mod_rewrite module or equivalent

Compatible Hosts

Sign in

Login details