Costum Field Types

Creating a custom field is straightforward, you basically need to inform Cockpit of the field:

create the a tag file, e.g. your-addon/assets/field-yourfieldname.tag

<field-yourfieldname>
  field markup...
  <script>
    js code..., you may invoke addon functions, etc..
  </script>
</field-yourfieldname>

in bootstrap.php:

$app->on('admin.init', function () {
  $this->helper('admin')->addAssets('youraddonname:assets/field-yourfieldname.tag');
});

check in modules/Cockpit/assets/components for the existing core fields

1 Like