I've created a custom module trying to implement new field types. I'm using How to create custom field type in Craft 3 and https://github.com/mmikkel/IncognitoField-Craft3 as reference on how to structure the module.
However, with a barebones version, I cannot seem to get the correct path to my templates. My module structure has the templates at:
SalesteamModule/src/templates/_components/fields/_input.twig
And the main function is:
public function getInputHtml($value, ElementInterface $element = null): string
{
// Get our id and namespace
$id = Craft::$app->getView()->formatInputId($this->handle);
$namespacedId = Craft::$app->getView()->namespaceInputId($id);
// Render the input template
return Craft::$app->getView()->renderTemplate(
'salesteam-module/_components/fields/_input',
[
'name' => $this->handle,
'value' => $value,
'field' => $this,
'id' => $id,
'namespacedId' => $namespacedId,
]
);
}
App.php
return [
// All environments
'*' => [
'modules' => [
'site-module' => [
'class' => \modules\sitemodule\SiteModule::class,
],
'salesteam-module' => [
'class' => \modules\salesteammodule\SalesteamModule::class,
],
],
'bootstrap' => ['site-module', 'salesteam-module'],
],
// Live (production) environment
'live' => [
],
// Staging (pre-production) environment
'staging' => [
],
// Local (development) environment
'local' => [
],
];
The module is registered as "salesteam-module" in the app config, so I don't think it's a module id thing. And the path I copied the structure of the Incognito plugin I posted above. Although that repo is a plugin, not a module if that makes any difference.
Not sure where to go from here since I've tried a whole slew of different path combinations.
Thanks