Jump to content

Requirements for valid Inputfield and Fieldtype - my modules won't show up!!


Rob
 Share

Recommended Posts

Hello forum,

I'm wondering why my Inputfield and Fieldtype I'm developing won't show up in the module list.  I wrote simple "single" Fieldtype and Inputfield classes last week and got them to work properly, but now I am trying to create a "multi" type Inputfield and corresponding Fieldtype and they don't seem to want to show up in the module listing.  In other words, my Fieldtype is extending FieldtypeMulti.  My Inputfield is just extending Inputfield top start so I can learn to render the correct form markup etc.

Are there a minimum set of methods that I need to implement for them to be valid?  I'm trying to compare them to existing Inputfield and Fieldtype classes to see if there's anything obvious.

Thanks.

Link to comment
Share on other sites

Rob– did you click the 'Check for New Modules' button at the top of the modules screen? If that didn't work, where did you place your files? (what directory) and what were the files called?

Btw the Module interface is here: /wire/core/Module.php, but there are only two required methods for PW to consider it a module:

public static function getModuleInfo();

public function init();

There are lots of optional methods, and that Module.php file outlines them all.

Link to comment
Share on other sites

Ryan,

I have a file called 'InputfieldLinkMultiple.module' inside '/site/modules/InputfieldLinkMultiple' and a file called 'FieldtypeLink.module' inside '/site/modules/Fieldtype'.

Class InputfieldLinkMultiple extends Inputfield implements InputfieldHasArrayValue {...}

Class FieldtypeLink extends FieldtypeMulti {...}

Both have getModuleInfo() and I assume have init() from the resepective superclasses.

Link to comment
Share on other sites

Rob, I can't think of why they wouldn't be recognized unless your class isn't specifically defining a getModuleInfo() function. That getModuleInfo is not something that can be inherited as it's the only thing that PW has to tell what your module is.  If you haven't defined that and made it return the proper array of info, then you need to do that. If you've already done that, then feel free to email the files to me and I can try from here. My email is ryan at this domain name.

Link to comment
Share on other sites

Right, they've just shown up, but  Ihad to delete some files from site/assets/cache.

The filenames started with Module I think.

Is there a setting I can change so I don't need to do this manually?

Link to comment
Share on other sites

Clicking the 'check for new modules' button should clear those cache files (that's what the button is for). The only thing I can figure is that maybe those files were no longer writable to PW for some reason? Either way, glad you got it resolved.

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...