I'm trying to build a simple dropdown field with a pre-populated set of options, so I figured I'd just import most of the methods from Craft's native Dropdown field. The plugin name is siteutilities and the field name is Regionselect:

namespace kgrote\siteutilities\fields;

use kgrote\siteutilities\SiteUtilities;

use Craft;
use craft\base\ElementInterface;
use craft\fields\BaseOptionsField; 

This pulls in the code from craft/vendor/craftcms/cms/src/fields/BaseOptionsField.php.

So now I want to render a custom settings template for my plugin:

public function getSettingsHtml()
    return Craft::$app->getView()->renderTemplate(
            'field' => $this,

But I get a Twig error:

Unable to find the template “_components/fields/Regionselect_settings”.

My plugin file structure looks like this:

    |  |-Regionselect.php
    |  |-_components
    |    |-fields
    |      |-Regionselect_settings.html
  • 1
    It searches for your template as well. Are you sure it's the correct path? Do you use a custom module instead of a plugin eventually? Commented Sep 19, 2018 at 22:07
  • @RobinSchambach I think so, I've updated the question with my plugin's file structure. And no I don't use a custom module, just a plugin.
    – kmgdev
    Commented Sep 20, 2018 at 19:57
  • 1
    Why a php file? You can only render twig and html files. All others won't be parsed/proceed by Twig Commented Sep 20, 2018 at 19:58
  • 1
    You need to include your plugin handle at the first position plugin-handle/_components/fields/Regionselect_settings Commented Sep 20, 2018 at 20:48
  • 1
    Sorry for being so slow. I somehow overview that mistake at the first sight. Commented Sep 20, 2018 at 21:09

1 Answer 1


In order to render a template within your custom plugin you need to include your plugin handle in front of your template path. For example


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.