/**
  * Gets the schema for this form as a nested array.
  *
  * @param Form $form
  * @return array
  */
 public function getSchema(Form $form)
 {
     $schema = ['name' => $form->getName(), 'id' => $form->FormName(), 'action' => $form->FormAction(), 'method' => $form->FormMethod(), 'attributes' => $form->getAttributes(), 'data' => [], 'fields' => [], 'actions' => []];
     /** @var FormField $action */
     foreach ($form->Actions() as $action) {
         $schema['actions'][] = $action->getSchemaData();
     }
     /** @var FormField $field */
     foreach ($form->Fields() as $field) {
         $schema['fields'][] = $field->getSchemaData();
     }
     return $schema;
 }
 /**
  * Return a link to this field.
  *
  * @param string $action
  *
  * @return string
  */
 public function Link($action = null)
 {
     return Controller::join_links($this->form->FormAction(), 'field/' . $this->name, $action);
 }