/** * Creates a form input * * @param string $name * @param string $label * @param int $id * @param bool $nocap * @return string The HTML for the field input */ protected function createFormCheckbox($name, $label = NULL, $id = NULL, $val = NULL) { /* * If an entry ID is supplied, load the entry and grab the element * needed to populate the input */ $entry = !empty($id) ? Page::getEntryById($id) : NULL; $data = !empty($id) ? htmlentities($entry[0][$name], ENT_QUOTES) : NULL; $checked = $data == $val ? ' checked="checked"' : NULL; return ' <label><input type="checkbox" name="' . $name . '" id="' . $name . '" value="' . $val . '"' . $checked . '/> ' . $label . '</label>'; }