This is an old revision of the document!
Table of Contents
PostViewModel
Layer: Core · Source: lib/core/Theme/PostViewModel.php:19 (lines 19–159)
final class PostViewModel extends AbstractThemeViewModel
Post view model.
Carries the already-escaped, display-ready fields for a single post (home, single, category, tag, blog and search list rendering). Templates print the getters directly; no logic, no queries.
Docblock Metadata
| Tag | Value |
|---|---|
@category | Theme |
@author | M.Noermoehammad |
@license | MIT |
@version | 1.0 |
Inheritance
| Relation | Type | Meaning |
|---|---|---|
| extends | ''AbstractThemeViewModel'' | parent class/interface |
Constants (0)
None.
Properties (0)
None declared.
Methods (17)
| Visibility | Method | Summary | Line |
|---|---|---|---|
| public static | fromRow() | Build a post view model from a prepared row. | 28 |
| public static | fromPrepared() | Build a post view model from already-prepared, already-safe values. | 73 |
| public | id() | @psalm-suppress PossiblyUnusedMethod – public getter consumed by public/themes | 85 |
| public | title() | @psalm-suppress PossiblyUnusedMethod – public getter consumed by public/themes | 90 |
| public | url() | @psalm-suppress PossiblyUnusedMethod – public getter consumed by public/themes | 95 |
| public | slug() | @psalm-suppress PossiblyUnusedMethod – public getter consumed by public/themes | 100 |
| public | author() | @psalm-suppress PossiblyUnusedMethod – public getter consumed by public/themes | 105 |
| public | date() | @psalm-suppress PossiblyUnusedMethod – public getter consumed by public/themes | 110 |
| public | excerpt() | @psalm-suppress PossiblyUnusedMethod – public getter consumed by public/themes | 115 |
| public | content() | @psalm-suppress PossiblyUnusedMethod – public getter consumed by public/themes | 120 |
| public | media() | @psalm-suppress PossiblyUnusedMethod – public getter consumed by public/themes | 125 |
| public | mediaCaption() | @psalm-suppress PossiblyUnusedMethod – public getter consumed by public/themes | 130 |
| public | tags() | @psalm-suppress PossiblyUnusedMethod – public getter consumed by public/themes | 135 |
| public | visibility() | @psalm-suppress PossiblyUnusedMethod – public getter consumed by public/themes | 140 |
| public | type() | @psalm-suppress PossiblyUnusedMethod – public getter consumed by public/themes | 145 |
| public | comments() | @psalm-suppress PossiblyUnusedMethod – public getter consumed by public/themes | 150 |
| public | topics() | @psalm-suppress PossiblyUnusedMethod – public getter consumed by public/themes | 155 |
fromRow()
public static function fromRow(array $row, callable $escape)
lines 28–57 (30)
Build a post view model from a prepared row.
| Parameter | Type | Default | Description |
|---|---|---|---|
$row | array | required | none |
$escape | callable | required | none |
Returns: (none declared) — static
fromPrepared()
public static function fromPrepared(array $prepared)
lines 73–82 (10)
Build a post view model from already-prepared, already-safe values.
Used by the theme card pipeline (prepare_post_card()): the values are escaped or sanitized exactly once at the normalization boundary, so they are stored verbatim with no second escaping pass. Fields that are trusted sanitized HTML (content, topics) must be passed as-is and printed as-is.
| Parameter | Type | Default | Description |
|---|---|---|---|
$prepared | array | required | none |
Returns: (none declared) — static
id()
public function id(): ?string
lines 85–88 (4)
@psalm-suppress PossiblyUnusedMethod – public getter consumed by public/themes
Takes no parameters.
Returns: ?string
title()
public function title(): ?string
lines 90–93 (4)
@psalm-suppress PossiblyUnusedMethod – public getter consumed by public/themes
Takes no parameters.
Returns: ?string
url()
public function url(): string
lines 95–98 (4)
@psalm-suppress PossiblyUnusedMethod – public getter consumed by public/themes
Takes no parameters.
Returns: string
slug()
public function slug(): ?string
lines 100–103 (4)
@psalm-suppress PossiblyUnusedMethod – public getter consumed by public/themes
Takes no parameters.
Returns: ?string
author()
public function author(): ?string
lines 105–108 (4)
@psalm-suppress PossiblyUnusedMethod – public getter consumed by public/themes
Takes no parameters.
Returns: ?string
date()
public function date(): ?string
lines 110–113 (4)
@psalm-suppress PossiblyUnusedMethod – public getter consumed by public/themes
Takes no parameters.
Returns: ?string
excerpt()
public function excerpt(): ?string
lines 115–118 (4)
@psalm-suppress PossiblyUnusedMethod – public getter consumed by public/themes
Takes no parameters.
Returns: ?string
content()
public function content(): ?string
lines 120–123 (4)
@psalm-suppress PossiblyUnusedMethod – public getter consumed by public/themes
Takes no parameters.
Returns: ?string
media()
public function media(): ?string
lines 125–128 (4)
@psalm-suppress PossiblyUnusedMethod – public getter consumed by public/themes
Takes no parameters.
Returns: ?string
mediaCaption()
public function mediaCaption(): ?string
lines 130–133 (4)
@psalm-suppress PossiblyUnusedMethod – public getter consumed by public/themes
Takes no parameters.
Returns: ?string
tags()
public function tags(): ?string
lines 135–138 (4)
@psalm-suppress PossiblyUnusedMethod – public getter consumed by public/themes
Takes no parameters.
Returns: ?string
visibility()
public function visibility(): ?string
lines 140–143 (4)
@psalm-suppress PossiblyUnusedMethod – public getter consumed by public/themes
Takes no parameters.
Returns: ?string
type()
public function type(): ?string
lines 145–148 (4)
@psalm-suppress PossiblyUnusedMethod – public getter consumed by public/themes
Takes no parameters.
Returns: ?string
comments()
public function comments(): ?string
lines 150–153 (4)
@psalm-suppress PossiblyUnusedMethod – public getter consumed by public/themes
Takes no parameters.
Returns: ?string
topics()
public function topics(): ?string
lines 155–158 (4)
@psalm-suppress PossiblyUnusedMethod – public getter consumed by public/themes
Takes no parameters.
Returns: ?string
This page is generated from source by 'tools/gendoc'. Edits will be overwritten.
