PostController::populateForm PHP Method

populateForm() protected method

Pre-populate the form with values from the query string.
protected populateForm ( Gdn_Form $Form )
$Form Gdn_Form
    protected function populateForm($Form)
    {
        $Get = $this->Request->get();
        $Get = array_change_key_case($Get);
        $Values = arrayTranslate($Get, array('name' => 'Name', 'tags' => 'Tags', 'body' => 'Body'));
        foreach ($Values as $Key => $Value) {
            $Form->setValue($Key, $Value);
        }
        if (isset($Get['category'])) {
            $Category = CategoryModel::categories($Get['category']);
            if ($Category && $Category['PermsDiscussionsAdd']) {
                $Form->setValue('CategoryID', $Category['CategoryID']);
            }
        }
    }