Body: <p>I have the following struggle. I tried to register my FieldType in my init function of the module.php.</p>
  <pre><code>Event::on(
          Fields::class,
          Fields::EVENT_REGISTER_FIELD_TYPES,
          function(RegisterComponentTypesEvent $event) {
              $event-&gt;types[] = SweVolley_StaffelSelectFieldType::class;
          }
      );
  </code></pre>
  <p>The Class SweVolley_StaffelSelectFieldType.php exists in the folder: /modules/site/fields</p>
  <p>The Error in the Browser:</p>
  <p>Class &quot;modules\site\Event&quot; not found</p>
  <p>I don't know why?</p>
  
Comments.ContentLicense: CC BY-SA 4.0
Comments.CreationDate: 2022-09-26T16:53:32.810Z
Comments.Text: Did you import the event class at the top of your class (`use yii\base\Event;`)? Full example in this Knowledge Base article: https://craftcms.com/knowledge-base/custom-module-events
Comments.UserDisplayName: Matt Stein
Comments.ContentLicense: CC BY-SA 4.0
Comments.CreationDate: 2022-09-29T08:00:27.620Z
Comments.Text: Yes I have import the class yii\base\Event
Comments.UserDisplayName: Jonathan Fuchs
Tags: <craft3><php><fieldtypes><custom-fieldtype>
Title: Register own FieldType in Craft 3.x
ThreadText: # Register own FieldType in Craft 3.x
  
  (Asked by: username_0 on 2022-09-26)
  
  I have the following struggle. I tried to register my FieldType in my init function of the module.php.
  
  ```
  Event::on(
          Fields::class,
          Fields::EVENT_REGISTER_FIELD_TYPES,
          function(RegisterComponentTypesEvent $event) {
              $event->types[] = SweVolley_StaffelSelectFieldType::class;
          }
      );
  
  ```
  
  The Class SweVolley\_StaffelSelectFieldType.php exists in the folder: /modules/site/fields
  
  The Error in the Browser:
  
  Class "modules\site\Event" not found
  
  I don't know why?
  
  **Tags:** craft3, php, fieldtypes, custom-fieldtype
  
  > **Comments:**
  > **username_1**: Did you import the event class at the top of your class (`use yii\base\Event;`)? Full example in this Knowledge Base article: https://craftcms.com/knowledge-base/custom-module-events  
  > **username_0**: Yes I have import the class yii\base\Event  
  
  ---
  
  ## 0 answers
  
  