Skip to content

Commit

Permalink
Add Document_PaperOption::render_document.
Browse files Browse the repository at this point in the history
  • Loading branch information
kohler committed Sep 5, 2023
1 parent e8b42b0 commit f1f3449
Showing 1 changed file with 14 additions and 11 deletions.
25 changes: 14 additions & 11 deletions src/paperoption.php
Original file line number Diff line number Diff line change
Expand Up @@ -1538,15 +1538,8 @@ function validate_document(DocumentInfo $doc) {
return false;
}

function render(FieldRender $fr, PaperValue $ov) {
if ($this->id <= 0 && $fr->want(FieldRender::CFPAGE)) {
if ($this->id === 0) {
$fr->table->render_submission($fr, $this);
}
return;
}

$d = $ov->document(0);
/** @param ?DocumentInfo $d */
static function render_document(FieldRender $fr, PaperOption $opt, $d) {
if (!$d) {
if ($fr->verbose()) {
$fr->set_text("None");
Expand All @@ -1559,8 +1552,8 @@ function render(FieldRender $fr, PaperValue $ov) {
} else if ($fr->want(FieldRender::CFFORM)) {
$fr->set_html($d->link_html(htmlspecialchars($d->filename), 0));
} else if ($fr->want(FieldRender::CFPAGE)) {
$th = $this->title_html();
$dif = $this->display() === PaperOption::DISP_TOP ? 0 : DocumentInfo::L_SMALL;
$th = $opt->title_html();
$dif = $opt->display() === PaperOption::DISP_TOP ? 0 : DocumentInfo::L_SMALL;
$fr->title = "";
$fr->set_html($d->link_html("<span class=\"pavfn\">{$th}</span>", $dif));
} else {
Expand All @@ -1573,6 +1566,16 @@ function render(FieldRender $fr, PaperValue $ov) {
}
}

function render(FieldRender $fr, PaperValue $ov) {
if ($this->id <= 0 && $fr->want(FieldRender::CFPAGE)) {
if ($this->id === 0) {
$fr->table->render_submission($fr, $this);
}
} else {
self::render_document($fr, $this, $ov->document(0));
}
}

function format_spec() {
$speckey = "sub_banal";
if ($this->id) {
Expand Down

0 comments on commit f1f3449

Please sign in to comment.