Jump to content

Templates Select (FieldtypeTemplates)


Hani

Recommended Posts

Thanks for all the prompts to get this updated and out on GitHub, everyone.  My apologies for not doing it a long time ago!

Here's the modules directory entry:

http://modules.processwire.com/modules/fieldtype-templates/

Out on GitHub:

https://github.com/Hani79/Processwire_FieldType_Templates

Shout out to @adrian for fixing the bug reported by @Raul and @lisandi  :)

  • Like 5
Link to comment
Share on other sites

  • 1 year later...

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);
Link to comment
Share on other sites

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
Link to comment
Share on other sites

  • 7 months later...

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. :-(

Link to comment
Share on other sites

  • 2 weeks later...

@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
Link to comment
Share on other sites

  • 1 year later...

@Karl_T

I fixed this too but without publishing here. Sorry for this :-[
Furthermore I added options for the label etc.

In the environments I use it (latest PW) everything works as expected, even single select. I forked now the original module and pushed my latest version on github.
https://github.com/kixe/Processwire_FieldType_Templates

 

  • Like 3
  • Thanks 1
Link to comment
Share on other sites

  • 5 years later...

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?

 

Link to comment
Share on other sites

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