Creating a Field Type
- Posted March 26, 2017
- Addon Development
- Essentials
Related Links
Introduction
Developing field types in Pyro is a piece of cake. To get started run the make:addon
command:
php artisan make:addon your_company.field_type.example
The above command will create a new addon in the /addons/{reference}
. From here you can continue building up your field type.
Field Type Class
The make:addon
command will create an empty field type class that looks like this:
<?php namespace YourCompany\ExampleFieldType;
use Anomaly\Streams\Platform\Addon\FieldType\FieldType;
class ExampleFieldType extends FieldType
{
}
We will explore this class in more detail later!
Title and Name
You can edit the field type's title (short), name (full), and description in the /resources/lang/{locale}/addon.php
file.
Service Provider
You will also notice that a service provider is created as well. You can read more about using service providers in the service providers section.