Skip to content

omnibase/press API reference

Floor
Prepared structure · Omnibase
Version
main
Verified for real
Its README does not say
Licence
MIT
composer require omnibase/press:dev-main

Read from the package's own PHP files at the commit 6c35618e0ddc: its namespaces, classes, interfaces and enums, their public constants, properties and methods with their PHPDoc, and the options its factories take. Nothing of it is run.

Base\Press

  • PressBundle class

    The press kit an artist's agency asks for: what was written about them (Quote), the pictures a programme may print (Photo), the biography in three lengths (Bio) - one page, /press, and three Twig functions.

    3 methods

Base\Press\Controller\Admin\Crud

  • BioCrudController class

    Writing the biographies: one per language and per length. Plain text, a blank line between two paragraphs; the words are counted as they are typed, against what the length is meant to hold (100, 250).

    5 methods

  • PhotoCrudController class

    The press pictures: the original as the photographer delivered it, the credit to print with it, a caption, whether it may be downloaded, and where it is shown: the press kit (/press), the site's gallery, or both.

    4 methods

  • QuoteCrudController class

    Filing what was said: the words, who said them and where, what about.

    8 methods

Base\Press\Controller\Client

  • PressController class

    The press page: what was written (the featured quotes), the biography in the reader's language - each length with its "copy" button -, the pictures with their credit and, when allowed, their original to download, and who to write to.

    3 methods · 1 constant

Base\Press\DependencyInjection

Base\Press\Entity

  • Bio class

    The biography, once per language and per length: the short one of a season brochure, the medium one of a programme note, the full one. Plain text, a blank line between two paragraphs - it is copied into a programme, not laid out here. The date it was last touched is shown with it: an agency wants to know the biography it prints is the current one.

    15 methods

  • Photo class

    A picture of the artist: the file as the photographer delivered it (up to 64 MB, a programme prints it), who took it - the credit a paper must print with it -, a caption, and where it is shown: in the press kit (/press, "visible"; its original downloadable or not), in the site's own gallery ("gallery", press_gallery()), or both.

    22 methods

  • Quote class

    What was said or written: the words, who said them ("Joshua Bell", "violinist"), where ("BBC Music Magazine", with its link and date), and what about (the album, the concert - a free reference, no relation).

    43 methods

Base\Press\Enum

  • BioLength enum

    The three biographies a presenter asks for: the one of a season brochure (about 100 words), the one of a programme note (about 250), the full one.

    1 method · 3 cases

  • QuoteKind enum

    Who speaks: a paper or a magazine, a colleague (a conductor, a fellow soloist), someone in the hall. A string enum (not omnibase's EnumType) so the column reads plainly in the database and in the admin's filters.

    3 cases

Base\Press\Repository

Base\Press\Service

  • PhotoFilename class

    The name a downloaded picture is saved under: "<site>-<slug>.<ext>" - "clara-weiss-portrait-with-harp.jpg" -, so the file in a journalist's downloads folder still says whose it is. The slug is the picture's title, else its credit, else its number.

    1 method

Base\Press\Twig

  • PressExtension class

    What a host's own pages ask the press kit: a few quotes for a home page (the featured ones first), the biography of one length for an "about" page, the press kit's pictures, the site's gallery, who to write to (press.contacts) for a contact page.

    2 methods

Base\Press

PressBundle class

class PressBundle extends AbstractBaseBundle PressBundle.php:14

The press kit an artist's agency asks for: what was written about them (Quote), the pictures a programme may print (Photo), the biography in three lengths (Bio) - one page, /press, and three Twig functions.

PressBundle::__construct()

public function __construct()

PressBundle::getPath()

public function getPath(): string

Modern layout: the class lives in src/, the bundle root is the package root.

PressBundle::build()

public function build(ContainerBuilder $container): void

Base\Press\Controller\Admin\Crud

BioCrudController class

class BioCrudController extends AbstractCrudController BioCrudController.php:23

Writing the biographies: one per language and per length. Plain text, a blank line between two paragraphs; the words are counted as they are typed, against what the length is meant to hold (100, 250).

BioCrudController::setPressLocales()

public function setPressLocales(array $locales = []): void

The site's languages (framework.enabled_locales), when it declares them.

BioCrudController::getEntityFqcn()

public static function getEntityFqcn(): string

BioCrudController::getPreferredIcon()

public static function getPreferredIcon(): ?string

BioCrudController::configureFilters()

public function configureFilters(Filters $filters): Filters

BioCrudController::configureFields()

public function configureFields(string $pageName): iterable

PhotoCrudController class

class PhotoCrudController extends AbstractCrudController PhotoCrudController.php:21

The press pictures: the original as the photographer delivered it, the credit to print with it, a caption, whether it may be downloaded, and where it is shown: the press kit (/press), the site's gallery, or both.

PhotoCrudController::getEntityFqcn()

public static function getEntityFqcn(): string

PhotoCrudController::getPreferredIcon()

public static function getPreferredIcon(): ?string

PhotoCrudController::configureFilters()

public function configureFilters(Filters $filters): Filters

PhotoCrudController::configureFields()

public function configureFields(string $pageName): iterable

QuoteCrudController class

class QuoteCrudController extends AbstractCrudController QuoteCrudController.php:30

Filing what was said: the words, who said them and where, what about.

One button on each - "feature" - puts a quote among the few a home page shows, or takes it back.

QuoteCrudController::setPressLocales()

public function setPressLocales(array $locales = []): void

The site's languages (framework.enabled_locales), when it declares them.

QuoteCrudController::setPressTranslator()

public function setPressTranslator(TranslatorInterface $translator): void

QuoteCrudController::getEntityFqcn()

public static function getEntityFqcn(): string

QuoteCrudController::getPreferredIcon()

public static function getPreferredIcon(): ?string

QuoteCrudController::configureFilters()

public function configureFilters(Filters $filters): Filters

QuoteCrudController::configureFields()

public function configureFields(string $pageName): iterable

QuoteCrudController::configureActions()

public function configureActions(Actions $actions): Actions

QuoteCrudController::feature()

public function feature(string $entityId): Response

Base\Press\Controller\Client

PressController class

class PressController extends AbstractController PressController.php:25

The press page: what was written (the featured quotes), the biography in the reader's language - each length with its "copy" button -, the pictures with their credit and, when allowed, their original to download, and who to write to.

const FALLBACK_LOCALE = 'en'

The language shown when the reader's has nothing: the one every agency reads.

PressController::__construct()

public function __construct(readonly QuoteRepository $quotes, readonly BioRepository $bios, readonly PhotoRepository $photos, readonly SettingBagInterface $settings, readonly array $contacts = [], readonly bool $downloadKit = true, readonly array $bioLengths = ['short', 'medium', 'long'])

PressController::index()

public function index(Request $request): Response

PressController::download()

public function download(Request $request, int $id): Response

The original, as the photographer delivered it, under a name that says whose it is.

Base\Press\DependencyInjection

PressConfiguration class

class PressConfiguration extends AbstractBaseConfiguration PressConfiguration.php:8

PressConfiguration::getConfigTreeBuilder()

public function getConfigTreeBuilder(): TreeBuilder

PressExtension class

class PressExtension extends AbstractBaseExtension PressExtension.php:11

PressExtension::getConfiguration()

public function getConfiguration(array $config, ContainerBuilder $container): PressConfiguration

PressExtension::load()

public function load(array $configs, ContainerBuilder $container): void

Base\Press\Entity

Bio class

class Bio Bio.php:19

The biography, once per language and per length: the short one of a season brochure, the medium one of a programme note, the full one. Plain text, a blank line between two paragraphs - it is copied into a programme, not laid out here. The date it was last touched is shown with it: an agency wants to know the biography it prints is the current one.

Bio::__construct()

public function __construct(string $locale = 'en', BioLength $length = BioLength::SHORT, ?string $content = null)

Bio::__toString()

public function __toString(): string

Bio::getId()

public function getId(): ?int

Bio::getLocale()

public function getLocale(): string

Bio::setLocale()

public function setLocale(?string $locale): self

Bio::getLength()

public function getLength(): BioLength

Bio::setLength()

public function setLength(BioLength|string $length): self

Bio::getContent()

public function getContent(): ?string

Bio::setContent()

public function setContent(?string $content): self

Bio::getUpdatedAt()

public function getUpdatedAt(): ?\DateTimeInterface

Bio::setUpdatedAt()

public function setUpdatedAt(?\DateTimeInterface $updatedAt): self

Bio::getParagraphs()

public function getParagraphs(): array
Returns

the paragraphs: what a blank line separates

Bio::getWordCount()

public function getWordCount(): int

Bio::isTooLong()

public function isTooLong(): bool

More words than its length is meant to hold (ten percent are forgiven); the full one never is.

Bio::countWords()

public static function countWords(string $text): int

The words of a text, the way a programme editor counts them: what stands between two blanks, in any alphabet - "l'archet" and "Sinfonie-Orchester" are one word each, a lone dash is none.

Photo class

class Photo Photo.php:18

A picture of the artist: the file as the photographer delivered it (up to 64 MB, a programme prints it), who took it - the credit a paper must print with it -, a caption, and where it is shown: in the press kit (/press, "visible"; its original downloadable or not), in the site's own gallery ("gallery", press_gallery()), or both.

Photo::__toString()

public function __toString(): string

Photo::getId()

public function getId(): ?int

Photo::getFile()

public function getFile(): ?string

Photo::setFile()

public function setFile($file): self

Photo::hasFile()

public function hasFile(): bool

Whether a picture is set, without asking the storage where it is.

Photo::getFileUrl()

public function getFileUrl(): ?string

The picture's address on the site ("/uploads/…"), what an <img> takes: the storage gives its public path from the server's root ("/srv/app/public/uploads/…"), the public directory is taken off.

Photo::getAlt()

public function getAlt(): string

What a screen reader says of the picture: its caption, else its title.

Photo::getTitle()

public function getTitle(): ?string

Photo::setTitle()

public function setTitle(?string $title): self

Photo::getCredit()

public function getCredit(): ?string

Photo::setCredit()

public function setCredit(?string $credit): self

Photo::getCreditLine()

public function getCreditLine(): ?string

The credit with its sign: "Harald Hoffmann" is printed "© Harald Hoffmann".

Photo::getCaption()

public function getCaption(): ?string

Photo::setCaption()

public function setCaption(?string $caption): self

Photo::isDownloadable()

public function isDownloadable(): bool

Photo::setDownloadable()

public function setDownloadable(bool $downloadable): self

Photo::getPosition()

public function getPosition(): int

Photo::setPosition()

public function setPosition(?int $position): self

Photo::isVisible()

public function isVisible(): bool

Photo::setVisible()

public function setVisible(bool $visible): self

Photo::isGallery()

public function isGallery(): bool

Photo::setGallery()

public function setGallery(bool $gallery): self

Quote class

class Quote Quote.php:22

What was said or written: the words, who said them ("Joshua Bell", "violinist"), where ("BBC Music Magazine", with its link and date), and what about (the album, the concert - a free reference, no relation).

The words are kept as they were said or written (language says in which tongue), with their translations beside them (translations: per language, the words and the speaker's quality): a reader sees the words in their own language when there is a translation, and may ask for the original (offerOriginal). locale only restricts a quote to the readers of one language (empty: shown to all).

Quote::__construct()

public function __construct(?string $text = null, ?string $author = null, ?string $source = null)

Quote::__toString()

public function __toString(): string

Quote::getId()

public function getId(): ?int

Quote::getText()

public function getText(): ?string

Quote::setText()

public function setText(?string $text): self

Quote::getLocale()

public function getLocale(): ?string

Quote::setLocale()

public function setLocale(?string $locale): self

Quote::getAuthor()

public function getAuthor(): ?string

Quote::setAuthor()

public function setAuthor(?string $author): self

Quote::getRole()

public function getRole(): ?string

Quote::setRole()

public function setRole(?string $role): self

Quote::getSource()

public function getSource(): ?string

Quote::setSource()

public function setSource(?string $source): self

Quote::getUrl()

public function getUrl(): ?string

Quote::setUrl()

public function setUrl(?string $url): self

Quote::getDate()

public function getDate(): ?\DateTimeImmutable

Quote::setDate()

public function setDate(?\DateTimeInterface $date): self

Quote::getKind()

public function getKind(): QuoteKind

Quote::setKind()

public function setKind(QuoteKind|string $kind): self

Quote::isFeatured()

public function isFeatured(): bool

Quote::setFeatured()

public function setFeatured(bool $featured): self

Quote::toggleFeatured()

public function toggleFeatured(): self

The back office's button: featured, or no longer.

Quote::getPosition()

public function getPosition(): int

Quote::setPosition()

public function setPosition(?int $position): self

Quote::getRelease()

public function getRelease(): ?string

Quote::setRelease()

public function setRelease(?string $release): self

Quote::isVisible()

public function isVisible(): bool

Quote::setVisible()

public function setVisible(bool $visible): self

Quote::getLanguage()

public function getLanguage(): ?string

Quote::setLanguage()

public function setLanguage(?string $language): self

Quote::isOfferOriginal()

public function isOfferOriginal(): bool

Quote::setOfferOriginal()

public function setOfferOriginal(bool $offer): self

Quote::getTranslations()

public function getTranslations(): array

Quote::setTranslations()

public function setTranslations(?array $translations): self
$translations

a bare string is the words

Quote::setTranslation()

public function setTranslation(string $locale, ?string $text, ?string $role = null): self

The words (and, when given, the speaker's quality) in one language; nothing of either removes it.

Quote::isTranslatedIn()

public function isTranslatedIn(string $locale): bool

Whether a reader of $locale reads a translation (there is one, and it is not the original's language).

Quote::getTextIn()

public function getTextIn(string $locale): ?string

The words for a reader of $locale: the translation, else the original.

Quote::getRoleIn()

public function getRoleIn(string $locale): ?string

The speaker's quality for a reader of $locale ("chef d'orchestre"), else as typed.

Quote::__isset()

public function __isset(string $name): bool

The back office's fields, one pair per language of the site: translation_fr (the words) and role_fr (the quality) read and write translations.

Quote::__get()

public function __get(string $name): ?string

Quote::__set()

public function __set(string $name, mixed $value): void

Quote::speaks()

public function speaks(string $locale): bool

Shown to a reader of $locale: written in it, or in no language in particular.

Quote::getSignature()

public function getSignature(): string

The line under the words: "Joshua Bell, violinist" or, with only the paper, "BBC Music Magazine". The source is not repeated when the role already names it.

Base\Press\Enum

BioLength enum

enum BioLength BioLength.php:9

The three biographies a presenter asks for: the one of a season brochure (about 100 words), the one of a programme note (about 250), the full one.

case SHORT = 'short'
case MEDIUM = 'medium'
case LONG = 'long'

BioLength::words()

public function words(): ?int

The words it is expected to hold; null: as long as it needs.

QuoteKind enum

enum QuoteKind QuoteKind.php:10

Who speaks: a paper or a magazine, a colleague (a conductor, a fellow soloist), someone in the hall. A string enum (not omnibase's EnumType) so the column reads plainly in the database and in the admin's filters.

case PRESS = 'press'
case COLLEAGUE = 'colleague'
case AUDIENCE = 'audience'

Base\Press\Repository

BioRepository class

class BioRepository extends ServiceEntityRepository BioRepository.php:11

BioRepository::__construct()

public function __construct(ManagerRegistry $registry)

BioRepository::findOneFor()

public function findOneFor(BioLength $length, string $locale, string $fallback = 'en'): ?Bio

The biography of one length in $locale, else in the fallback language.

BioRepository::findByLength()

public function findByLength(string $locale, array $lengths = ['short', 'medium', 'long'], string $fallback = 'en'): array

The biographies of a page, by length, each in $locale or else in the fallback language; a length nobody wrote is left out.

$lengths

the lengths wanted, in order ('short', 'medium', 'long')

Returns

length => biography

PhotoRepository class

class PhotoRepository extends ServiceEntityRepository PhotoRepository.php:10

PhotoRepository::__construct()

public function __construct(ManagerRegistry $registry)

PhotoRepository::findVisible()

public function findVisible(?int $limit = null): array
Returns

the pictures shown, in their order

PhotoRepository::findGallery()

public function findGallery(?int $limit = null): array
Returns

the pictures of the site's own gallery, in their order

QuoteRepository class

class QuoteRepository extends ServiceEntityRepository QuoteRepository.php:11

QuoteRepository::__construct()

public function __construct(ManagerRegistry $registry)

QuoteRepository::findVisible()

public function findVisible(?string $locale = null, ?QuoteKind $kind = null, ?int $limit = null, bool $featuredOnly = false): array

The quotes shown to a reader of $locale - written in it, or in no language in particular -, the featured ones first, then in their order, the newest first among equals. No locale: every language.

QuoteRepository::findForLocale()

public function findForLocale(string $locale, string $fallback = 'en', ?QuoteKind $kind = null, ?int $limit = null, bool $featuredOnly = false): array

The same, falling back on another language (English) when the reader's has nothing: a German page with no German quote shows the English ones rather than none.

Base\Press\Service

PhotoFilename class

final class PhotoFilename PhotoFilename.php:13

The name a downloaded picture is saved under: "<site>-<slug>.<ext>" - "clara-weiss-portrait-with-harp.jpg" -, so the file in a journalist's downloads folder still says whose it is. The slug is the picture's title, else its credit, else its number.

PhotoFilename::of()

public static function of(?string $site, ?string $title, ?string $credit, ?int $id, ?string $extension): string

Base\Press\Twig

PressExtension class

final class PressExtension extends AbstractExtension PressExtension.php:22

What a host's own pages ask the press kit: a few quotes for a home page (the featured ones first), the biography of one length for an "about" page, the press kit's pictures, the site's gallery, who to write to (press.contacts) for a contact page.

PressExtension::__construct()

public function __construct(readonly QuoteRepository $quotes, readonly BioRepository $bios, readonly PhotoRepository $photos, readonly RequestStack $requests, readonly array $contacts = [])

PressExtension::getFunctions()

public function getFunctions(): array