Jump to content

Recommended Posts

  • 1 year later...
Posted

I know this module is a bit older but I figured I would bump it to see if anyone knew the answer. I was going to use this on a module and was having a hard time implementing it. It looks to function perfectly attached to templates, but when I try and use it in my module I get the error:  Method FieldtypeTemplates::setParent does not exist or is not callable in this context. I have checked and there doesn't seem to be any issues with a standard asm field. Anyone happen to know what I am doing wrong?

$inputfields = new InputfieldWrapper();
$modules = Wire::getFuel('modules');//I was using wire('modules') with the same result, I just wanted to try this method
$f = $modules->get("FieldtypeTemplates");
$inputfields->add($f);
Posted

First of all, fieldtype modules are not inputfields, so your posted code does not work no matter which field you actually want to add. Additionally some inputfields depend on their corresponding fieldtype, which makes them unusable in plain inputfield mode, which the module settings are using. Fieldtypes are only used in context of templates, as they handle things like persisting data to the db, which is only needed for pages. This module does not even have an inputfield, because it's using the core one, so to get the same functionality in the modules settings you can copy the code from the getInputfield() function of the module into your code.

  • Like 3
  • 7 months later...
Posted

Selections aren't being retained or are being automatically selected/deselected in the "Template Types" area under the "Details" tab. If I make multiple edits to these checkboxes and save the page after each edit, the module is confused about my settings and messes up what I selected. :-(

  • 2 weeks later...
Posted

@Lance O.
If you use PW Version 3.0.22 >:D you should make an update to the last available version. This should solve your problems. The date of your post looks a bit '3.0.22ish'

@Hani
Thanks for this great module. It is working as expected. Even in the latest 3.0.x
I made the inputfield selectable to make all subclasses of 'InputfieldSelect' available.

FieldTypeTemplates.zip

  • Like 1
  • 1 year later...
  • 5 years later...
Posted

I have tried updating from 3.x to 3.0.200, however I get the following error in my log:

2022-10-17 19:51:04	?		Fatal Error:  
Uncaught Error: Class "FieldtypeMulti" not found in site/modules/FieldtypeTemplates/FieldtypeTemplates.module:30 

Stack trace: 
#0 /wire/core/Modules.php(1686): include_once() 
#1 /wire/core/Modules.php(1605): ProcessWire\Modules->includeModuleFile() 
#2 /wire/core/WireClassLoader.php(284): ProcessWire\Modules->includeModule() #3 [internal function]: ProcessWire\WireClassLoader->loadClass() 
#4 /wire/core/Modules.php(2739): class_exists() 
#5 /wire/core/Modules.php(3023): ProcessWire\Modules->getModuleInfoInternal() 
#6 /wire/core/Modules.php(1106): ProcessWire\Modules->getModuleInfo() 
#7 wire/core/Modules.php(913): ProcessWire\Modules->loadModule() 
#8 /wire/core/Modules.php(389): ProcessWire\Modules->load() 
#9 /wire/core/ProcessWire.php(536): ProcessWire\Modules->init() 
#10 /wire/core/ProcessWire.php(314): ProcessWire\ProcessWire->load() 
#11 /index.php(52): ProcessWire\ProcessWire->__construct() #12 {main}   thrown (line 30 of /site/modules/FieldtypeTemplates/FieldtypeTemplates.module)

Any ideas?

 

  • 6 months later...
Posted
On 10/18/2022 at 12:24 AM, AndreasWeinzierl said:

I have tried updating from 3.x to 3.0.200, however I get the following error in my log:

2022-10-17 19:51:04	?		Fatal Error:  
Uncaught Error: Class "FieldtypeMulti" not found in site/modules/FieldtypeTemplates/FieldtypeTemplates.module:30 

Stack trace: 
#0 /wire/core/Modules.php(1686): include_once() 
#1 /wire/core/Modules.php(1605): ProcessWire\Modules->includeModuleFile() 
#2 /wire/core/WireClassLoader.php(284): ProcessWire\Modules->includeModule() #3 [internal function]: ProcessWire\WireClassLoader->loadClass() 
#4 /wire/core/Modules.php(2739): class_exists() 
#5 /wire/core/Modules.php(3023): ProcessWire\Modules->getModuleInfoInternal() 
#6 /wire/core/Modules.php(1106): ProcessWire\Modules->getModuleInfo() 
#7 wire/core/Modules.php(913): ProcessWire\Modules->loadModule() 
#8 /wire/core/Modules.php(389): ProcessWire\Modules->load() 
#9 /wire/core/ProcessWire.php(536): ProcessWire\Modules->init() 
#10 /wire/core/ProcessWire.php(314): ProcessWire\ProcessWire->load() 
#11 /index.php(52): ProcessWire\ProcessWire->__construct() #12 {main}   thrown (line 30 of /site/modules/FieldtypeTemplates/FieldtypeTemplates.module)

Any ideas?

 

Hi @AndreasWeinzierl! Got into same trouble. Fortunatelty, it can be fixed quite easily. Just uncomment

//namespace ProcessWire;

at the very beginning of the module. Have no guess why @kixe had commented it. Works fine after uncommenting, at least for me )  

  • Like 1

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
×
×
  • Create New...