Scriptlog Docs

Scriptlog Documentation

Code reference for the Scriptlog codebase

User Tools

Site Tools


scriptlog:lib:core:themeviewmodelfactory

This is an old revision of the document!


ThemeViewModelFactory

Layer: Core · Source: lib/core/Theme/ThemeViewModelFactory.php:19 (lines 19–192)


final class ThemeViewModelFactory

ThemeViewModelFactory

Turns prepared arrays from FrontService/models into typed, already-escaped view models. All escaping flows through the single theme_escape_html() boundary so every theme renders from the same safe data shape.

Docblock Metadata

^ Tag ^ Value ^
| ''@category'' | Theme |
| ''@author'' | M.Noermoehammad |
| ''@license'' | MIT |
| ''@version'' | 1.0 |

Inheritance

No parent, interface or trait. This is a root type.

Constants (0)

None.

Properties (0)

None declared.

Methods (12)

^ Visibility ^ Method ^ Summary ^ Line ^
| public | ''__construct()'' |  | 28 |
| public | ''makePost()'' | Create a post view model. | 41 |
| public | ''makePostFromPrepared()'' | Create a post view model from already-prepared, already-safe values. | 60 |
| public | ''makePage()'' | Create a page view model. | 74 |
| public | ''makePageFromPrepared()'' | Create a page view model from already-prepared, already-safe values. | 88 |
| public | ''makeArchive()'' | Create an archive view model. | 102 |
| public | ''makeArchiveFromPrepared()'' | Create an archive view model from already-prepared, already-safe values. | 116 |
| public | ''makeMenu()'' | Create a menu view model. | 130 |
| public | ''makeMenuFromPrepared()'' | Create a menu view model from already-prepared, already-safe values. | 144 |
| public | ''makeSidebar()'' | Create a sidebar view model. | 158 |
| public | ''makeSidebarFromPrepared()'' | Create a sidebar view model from already-prepared, already-safe values. | 172 |
| public | ''makePosts()'' | Create a collection of post view models from a list of rows. | 186 |

__construct()

public function __construct(?callable $escape = null)

lines 28–33 (6)

^ Parameter ^ Type ^ Default ^ Description ^
| ''$escape'' | ''?callable'' | ''null'' | //none// |

makePost()

public function makePost(array $row): PostViewModel

lines 41–44 (4)

Create a post view model.

^ Parameter ^ Type ^ Default ^ Description ^
| ''$row'' | ''array'' | //required// | //none// |

Returns: ''PostViewModel'' — PostViewModel

makePostFromPrepared()

public function makePostFromPrepared(array $prepared): PostViewModel

lines 60–63 (4)

Create a post view model from already-prepared, already-safe values.

Used by the theme card pipeline (prepare_post_card()): values are escaped/sanitized exactly once at the normalization boundary, so the factory is the single creation point for both raw rows and prepared values.

^ Parameter ^ Type ^ Default ^ Description ^
| ''$prepared'' | ''array'' | //required// | //none// |

Returns: ''PostViewModel'' — PostViewModel

makePage()

public function makePage(array $row): PageViewModel

lines 74–77 (4)

Create a page view model.

^ Parameter ^ Type ^ Default ^ Description ^
| ''$row'' | ''array'' | //required// | //none// |

Returns: ''PageViewModel'' — PageViewModel

makePageFromPrepared()

public function makePageFromPrepared(array $prepared): PageViewModel

lines 88–91 (4)

Create a page view model from already-prepared, already-safe values.

^ Parameter ^ Type ^ Default ^ Description ^
| ''$prepared'' | ''array'' | //required// | //none// |

Returns: ''PageViewModel'' — PageViewModel

makeArchive()

public function makeArchive(array $row): ArchiveViewModel

lines 102–105 (4)

Create an archive view model.

^ Parameter ^ Type ^ Default ^ Description ^
| ''$row'' | ''array'' | //required// | //none// |

Returns: ''ArchiveViewModel'' — ArchiveViewModel

makeArchiveFromPrepared()

public function makeArchiveFromPrepared(array $prepared): ArchiveViewModel

lines 116–119 (4)

Create an archive view model from already-prepared, already-safe values.

^ Parameter ^ Type ^ Default ^ Description ^
| ''$prepared'' | ''array'' | //required// | //none// |

Returns: ''ArchiveViewModel'' — ArchiveViewModel

makeMenu()

public function makeMenu(array $row): MenuViewModel

lines 130–133 (4)

Create a menu view model.

^ Parameter ^ Type ^ Default ^ Description ^
| ''$row'' | ''array'' | //required// | //none// |

Returns: ''MenuViewModel'' — MenuViewModel

makeMenuFromPrepared()

public function makeMenuFromPrepared(array $prepared): MenuViewModel

lines 144–147 (4)

Create a menu view model from already-prepared, already-safe values.

^ Parameter ^ Type ^ Default ^ Description ^
| ''$prepared'' | ''array'' | //required// | //none// |

Returns: ''MenuViewModel'' — MenuViewModel

makeSidebar()

public function makeSidebar(array $row): SidebarViewModel

lines 158–161 (4)

Create a sidebar view model.

^ Parameter ^ Type ^ Default ^ Description ^
| ''$row'' | ''array'' | //required// | //none// |

Returns: ''SidebarViewModel'' — SidebarViewModel

makeSidebarFromPrepared()

public function makeSidebarFromPrepared(array $prepared): SidebarViewModel

lines 172–175 (4)

Create a sidebar view model from already-prepared, already-safe values.

^ Parameter ^ Type ^ Default ^ Description ^
| ''$prepared'' | ''array'' | //required// | //none// |

Returns: ''SidebarViewModel'' — SidebarViewModel

makePosts()

public function makePosts(array $rows): array

lines 186–191 (6)

Create a collection of post view models from a list of rows.

^ Parameter ^ Type ^ Default ^ Description ^
| ''$rows'' | ''array'' | //required// | //none// |

Returns: array — PostViewModel[]


This page is generated from source by 'tools/gendoc'. Edits will be overwritten.

scriptlog/lib/core/themeviewmodelfactory.1790413762.txt.gz · Last modified: by admin