<p>Where are you storing your mapElement template? - Unless it is stored in the same folder as the templates for the front end of your site, then </p>

<pre><code>Craft::$app-&gt;getView()-&gt;setTemplateMode(View::TEMPLATE_MODE_SITE);
</code></pre>

<p>is telling craft to look in the wrong place.</p>

<p>If you've got it stored in your plugin directory, then you don't need to change the template mode at all, as per : <a href="https://docs.craftcms.com/v3/extend/updating-plugins.html#rendering-templates" rel="nofollow noreferrer">https://docs.craftcms.com/v3/extend/updating-plugins.html#rendering-templates</a></p>

CC BY-SA 4.0
2019-08-13T07:52:42.580Z
Yes, I've initially tried without the Template mode but I still can't find the template. I can't even track where it's looking for the template.
For now what works for me in the getInputHTML is to return HTML input without redirecting.
ves
CC BY-SA 4.0
2019-08-12T15:52:41.893Z
2019-08-12T15:52:41.893Z
Nick
<p>I am still relatively new to Craft CMS.
I am trying to make a custom field plugin for Craft 3 but I am struggling to understand why I can't render my form template.</p>
<p>The fieldtype should render a map with markers in an entry, depending on which checkbox is clicked before map creation.</p>
<p>I have the following code in my Field.php file:</p>
<pre><code>public function getInputHtml($value, ElementInterface $element = null): string
{ 
...

Craft::$app-&gt;getView()-&gt;setTemplateMode(View::TEMPLATE_MODE_SITE);
$input = Craft::$app-&gt;getView()-&gt;renderTemplate('locations-map/_includes/forms/mapElement', $variables);
}
</code></pre>
<p>And I get the following error:
<a href="https://i.sstatic.net/ijvEw.png" rel="nofollow noreferrer"><img src="https://i.sstatic.net/ijvEw.png" alt="enter image description here" /></a></p>
<p>This is the result from all the vague(in my opinion) information in the internet about making custom field types in Craft 3 CMS.</p>
<p>If you have an idea how to access this template or just any information about custom fields, please feel free to share. (Yes, I have read the official documentation)</p>

<plugin-development><craft3><custom-fieldtype><custom-field><twigextension>
Custom field plugin: Unable to find template / General custom field plugin information
# Custom field plugin: Unable to find template / General custom field plugin information

(Asked by: username_0 on 2019-08-12)

I am still relatively new to Craft CMS.
I am trying to make a custom field plugin for Craft 3 but I am struggling to understand why I can't render my form template.
The fieldtype should render a map with markers in an entry, depending on which checkbox is clicked before map creation.
I have the following code in my Field.php file:
public function getInputHtml($value, ElementInterface $element = null): string
{ 
...

Craft::$app->getView()->setTemplateMode(View::TEMPLATE_MODE_SITE);
$input = Craft::$app->getView()->renderTemplate('locations-map/_includes/forms/mapElement', $variables);
}

And I get the following error:

This is the result from all the vague(in my opinion) information in the internet about making custom field types in Craft 3 CMS.
If you have an idea how to access this template or just any information about custom fields, please feel free to share. (Yes, I have read the official documentation)

**Tags:** plugin-development, craft3, custom-fieldtype, custom-field, twigextension

---

## 1 answers

### Answer by username_1 on 2019-08-12. Score: 1 | Accepted answer

Where are you storing your mapElement template? - Unless it is stored in the same folder as the templates for the front end of your site, then 
Craft::$app->getView()->setTemplateMode(View::TEMPLATE_MODE_SITE);

is telling craft to look in the wrong place.
If you've got it stored in your plugin directory, then you don't need to change the template mode at all, as per : https://docs.craftcms.com/v3/extend/updating-plugins.html#rendering-templates

> **Comments:**
> **username_0**: Yes, I've initially tried without the Template mode but I still can't find the template. I can't even track where it's looking for the template. For now what works for me in the getInputHTML is to return HTML input without redirecting.  

---

