I am currently struggling with my intent to extend the structure field within my own field plugin? I built a simple plugin called “Module” to use the StructureField within site/fields/module/module.php.
<?php
class ModuleField extends StructureField {
}
I would expect that it uses the base class StructureField and behaves like normal, but it throws an exception “Invalid field”.
So for some reason I’ve changed the add url with snippetfield instead of structurefield. That’s because we don’t want to use the route of the structure field.
If we look a bit more there is a function called routes() within the field and it goes magically to the name of the field, in this case snippetfield.