Baikal\Model\User::formMorphologyForThisModelInstance PHP Метод

formMorphologyForThisModelInstance() публичный Метод

    function formMorphologyForThisModelInstance()
    {
        $oMorpho = new \Formal\Form\Morphology();
        $oMorpho->add(new \Formal\Element\Text(["prop" => "username", "label" => "Username", "validation" => "required,unique", "popover" => ["title" => "Username", "content" => "The login for this user account.<br />It has to be unique."]]));
        $oMorpho->add(new \Formal\Element\Text(["prop" => "displayname", "label" => "Display name", "validation" => "required", "popover" => ["title" => "Display name", "content" => "This is the name that will be displayed in your CalDAV/CardDAV clients."]]));
        $oMorpho->add(new \Formal\Element\Text(["prop" => "email", "label" => "Email", "validation" => "required,email"]));
        $oMorpho->add(new \Formal\Element\Password(["prop" => "password", "label" => "Password"]));
        $oMorpho->add(new \Formal\Element\Password(["prop" => "passwordconfirm", "label" => "Confirm password", "validation" => "sameas:password"]));
        if ($this->floating()) {
            $oMorpho->element("username")->setOption("help", "May be an email, but not forcibly.");
            $oMorpho->element("password")->setOption("validation", "required");
        } else {
            $sNotice = "-- Leave empty to keep current password --";
            $oMorpho->element("username")->setOption("readonly", true);
            $oMorpho->element("password")->setOption("popover", ["title" => "Password", "content" => "Write something here only if you want to change the user password."]);
            $oMorpho->element("passwordconfirm")->setOption("popover", ["title" => "Confirm password", "content" => "Write something here only if you want to change the user password."]);
            $oMorpho->element("password")->setOption("placeholder", $sNotice);
            $oMorpho->element("passwordconfirm")->setOption("placeholder", $sNotice);
        }
        return $oMorpho;
    }