public function __construct($form = null) { // If there is a form passed into the constructor set the form and form control properties. if ($form instanceof MForm) { $this->form = $form; $this->formControl = $form->getFormControl(); } // Detect the field type if not set if (!isset($this->type)) { $parts = MString::splitCamelCase(get_class($this)); if ($parts[0] == 'M') { $this->type = MString::ucfirst($parts[count($parts) - 1], '_'); } else { $this->type = MString::ucfirst($parts[0], '_') . MString::ucfirst($parts[count($parts) - 1], '_'); } } }