Aller au contenu

omnibase/faq Référence de l’API

Étage
Structure préparée · Omnibase
Version
main
Vérifié en réel
Son README ne le dit pas
Licence
MIT
composer require omnibase/faq:dev-main

Lue dans les fichiers PHP du paquet au commit a9693c953418 : ses espaces de noms, classes, interfaces et énumérations, leurs constantes, propriétés et méthodes publiques avec leur PHPDoc, et les options que prennent ses fabriques. Rien n’en est exécuté.

Base\Faq

  • FaqBundle class

    A FAQ on top of omnibase's Thread (the questions) and Taxon (the sections).

    3 methods

Base\Faq\Admin\Widget

  • PendingQuestionsWidgetType class

    The dashboard's tile: the questions still drafts - asked by visitors, or started and not finished.

    4 methods

Base\Faq\Controller\Admin

  • OpenToAdminsTrait trait

    This bundle's screens are written by the site's administrators (ROLE_ADMIN: a teacher, an editor), not only by the super-admin the admin bundle requires by default for anything that writes - as omnibase/estate does. $custom names the screen's own actions (#[AdminAction]).

Base\Faq\Controller\Admin\Crud

  • QuestionCrudController class

    Answering the questions: the question (its title), the answer (its text), its section, its place, "à la une" for the home page. A visitor's question arrives as a draft, what they wrote in its preview, their e-mail kept to tell them.

    6 methods

  • SectionCrudController class

    The FAQ's sections: omnibase's taxon screen, plus their order.

    3 methods

Base\Faq\Controller\Client

  • FaqController class

    The FAQ: every section with its questions folded (<details>), a search, one question at its own address, and the form to ask another - which lands as a draft in the back office once Akismet has read it. Both pages carry schema.org's FAQPage (Service\JsonLd).

    3 methods

Base\Faq\DependencyInjection

Base\Faq\Entity

  • Ask class

    What a visitor types in "Il manque une question ?": not an entity - a form model Akismet reads (SpamProtectionInterface) before it becomes a draft Question in the back office. A doubtful one is refused outright: the teacher's inbox is not a moderation queue.

    5 methods · 5 properties

  • Question class

    A question and its answer: an omnibase thread whose title is the question and whose text is the answer. Published, it is on /faq in its section (a taxon); a draft waits in the back office - the ones visitors ask arrive as drafts (Ask, FaqController::ask). Likes count the readers it helped.

    12 methods

  • Section class

    A section of the FAQ ("Utiliser mes ressources", "La boutique"): an omnibase taxon, so it has a translated label and description, an icon, and may hold sub-sections. Its questions are the threads it classifies.

    4 methods

Base\Faq\Form

  • AskType class

    "Il manque une question ?": the question, a few details, an e-mail to be told once it is answered. Guarded as glitchr/omnibase guards a form (its option `guard`, action "ask"): a trap, the time it takes, the lists, the captcha when the site has glitchr/omnishield; Akismet reads what is written (the data_class implements SpamProtectionInterface); reCAPTCHA v3 in place of the guard's captcha when the host turned it on (glitchr/ux-google).

    2 methods

Base\Faq\Repository

Base\Faq\Service

  • AskNotifier class

    The administrators told of a question asked: the bell, and an e-mail, with a link to the draft.

    2 methods

  • JsonLd class

    The questions as schema.org reads them: a FAQPage whose mainEntity is each Question with its acceptedAnswer. Plain arrays: the template encodes them. A question without an answer is left out - a FAQPage entry needs one.

    2 methods

Base\Faq\Twig

  • FaqExtension class

    What a host page asks the FAQ: a few questions for the home page, the sections for a menu.

    2 methods

Base\Faq

FaqBundle class

class FaqBundle extends AbstractBaseBundle FaqBundle.php:10

A FAQ on top of omnibase's Thread (the questions) and Taxon (the sections).

FaqBundle::__construct()

public function __construct()

FaqBundle::getPath()

public function getPath(): string

FaqBundle::build()

public function build(ContainerBuilder $container): void

Base\Faq\Admin\Widget

PendingQuestionsWidgetType class

final class PendingQuestionsWidgetType implements DashboardWidgetTypeInterface PendingQuestionsWidgetType.php:10

The dashboard's tile: the questions still drafts - asked by visitors, or started and not finished.

PendingQuestionsWidgetType::__construct()

public function __construct(readonly QuestionRepository $questions)

PendingQuestionsWidgetType::getName()

public static function getName(): string

PendingQuestionsWidgetType::getTemplate()

public function getTemplate(): string

PendingQuestionsWidgetType::getTemplateVars()

public function getTemplateVars(MenuItem $widget): array

Base\Faq\Controller\Admin

OpenToAdminsTrait trait

trait OpenToAdminsTrait OpenToAdminsTrait.php:14

This bundle's screens are written by the site's administrators (ROLE_ADMIN: a teacher, an editor), not only by the super-admin the admin bundle requires by default for anything that writes - as omnibase/estate does. $custom names the screen's own actions (#[AdminAction]).

Base\Faq\Controller\Admin\Crud

QuestionCrudController class

class QuestionCrudController extends AbstractCrudController QuestionCrudController.php:27

Answering the questions: the question (its title), the answer (its text), its section, its place, "à la une" for the home page. A visitor's question arrives as a draft, what they wrote in its preview, their e-mail kept to tell them.

QuestionCrudController::getEntityFqcn()

public static function getEntityFqcn(): string

QuestionCrudController::getPreferredIcon()

public static function getPreferredIcon(): ?string

QuestionCrudController::configureFilters()

public function configureFilters(Filters $filters): Filters

QuestionCrudController::configureActions()

public function configureActions(Actions $actions): Actions

QuestionCrudController::configureFields()

public function configureFields(string $pageName): iterable

QuestionCrudController::createEntity()

public function createEntity(string $entityFqcn): object

SectionCrudController class

class SectionCrudController extends TaxonCrudController SectionCrudController.php:12

The FAQ's sections: omnibase's taxon screen, plus their order.

SectionCrudController::configureActions()

public function configureActions(Actions $actions): Actions

SectionCrudController::getEntityFqcn()

public static function getEntityFqcn(): string

SectionCrudController::getPreferredIcon()

public static function getPreferredIcon(): ?string

Base\Faq\Controller\Client

FaqController class

class FaqController extends AbstractController FaqController.php:27

The FAQ: every section with its questions folded (<details>), a search, one question at its own address, and the form to ask another - which lands as a draft in the back office once Akismet has read it. Both pages carry schema.org's FAQPage (Service\JsonLd).

FaqController::__construct()

public function __construct(readonly QuestionRepository $questions, readonly EntityManagerInterface $entityManager, readonly AskNotifier $notifier, readonly bool $askEnabled = true, readonly int $perSection = 20, readonly int $minDelay = 4, readonly ?\Google\Service\GrService $recaptcha = null, readonly ?JsonLd $jsonLd = null)

FaqController::index()

public function index(Request $request): Response

FaqController::question()

public function question(string $slug): Response

Base\Faq\DependencyInjection

FaqConfiguration class

class FaqConfiguration extends AbstractBaseConfiguration FaqConfiguration.php:8

FaqConfiguration::getConfigTreeBuilder()

public function getConfigTreeBuilder(): TreeBuilder

FaqExtension class

class FaqExtension extends AbstractBaseExtension FaqExtension.php:11

FaqExtension::getConfiguration()

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

FaqExtension::load()

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

Base\Faq\Entity

Ask class

final class Ask implements SpamProtectionInterface Ask.php:16

What a visitor types in "Il manque une question ?": not an entity - a form model Akismet reads (SpamProtectionInterface) before it becomes a draft Question in the back office. A doubtful one is refused outright: the teacher's inbox is not a moderation queue.

public ?string $question = null
public ?string $details = null
public ?string $email = null
public ?User $author = null
public ?int $spamScore = null

Ask::getSpamBlameable()

public function getSpamBlameable(): ?User

Ask::getSpamText()

public function getSpamText(): ?string

Ask::getSpamDate()

public function getSpamDate(): \DateTime

Ask::getSpamCallback()

public function getSpamCallback(int $score): void

Ask::isDoubtful()

public function isDoubtful(): bool

Question class

class Question extends Thread implements LinkableInterface Question.php:19

A question and its answer: an omnibase thread whose title is the question and whose text is the answer. Published, it is on /faq in its section (a taxon); a draft waits in the back office - the ones visitors ask arrive as drafts (Ask, FaqController::ask). Likes count the readers it helped.

Question::__iconizeStatic()

public static function __iconizeStatic(): ?array
public function __toLink(array $routeParameters = [], int $referenceType = UrlGeneratorInterface::ABSOLUTE_PATH): ?string

Question::__toString()

public function __toString(): string

Question::getPosition()

public function getPosition(): int

Question::setPosition()

public function setPosition(int $position): self

Question::isFeatured()

public function isFeatured(): bool

Question::setFeatured()

public function setFeatured(bool $featured): self

Question::getAskedBy()

public function getAskedBy(): ?string

Question::setAskedBy()

public function setAskedBy(?string $email): self

Question::getSection()

public function getSection(): ?Section

Question::setSection()

public function setSection(?Section $section): self

Question::publish()

public function publish(bool $published = true): self

Section class

class Section extends Taxon Section.php:14

A section of the FAQ ("Utiliser mes ressources", "La boutique"): an omnibase taxon, so it has a translated label and description, an icon, and may hold sub-sections. Its questions are the threads it classifies.

Section::__iconizeStatic()

public static function __iconizeStatic(): ?array

Section::getPosition()

public function getPosition(): int

Section::setPosition()

public function setPosition(int $position): self

Section::getPublishedQuestions()

public function getPublishedQuestions(): array
Returns

the published questions of this section, in order

Base\Faq\Form

AskType class

final class AskType extends AbstractType AskType.php:23

"Il manque une question ?": the question, a few details, an e-mail to be told once it is answered. Guarded as glitchr/omnibase guards a form (its option guard, action "ask"): a trap, the time it takes, the lists, the captcha when the site has glitchr/omnishield; Akismet reads what is written (the data_class implements SpamProtectionInterface); reCAPTCHA v3 in place of the guard's captcha when the host turned it on (glitchr/ux-google).

AskType::buildForm()

public function buildForm(FormBuilderInterface $builder, array $options): void

AskType::configureOptions()

public function configureOptions(OptionsResolver $resolver): void

Base\Faq\Repository

QuestionRepository class

class QuestionRepository extends ServiceEntityRepository QuestionRepository.php:13

QuestionRepository::__construct()

public function __construct(ManagerRegistry $registry)

QuestionRepository::findPublished()

public function findPublished(?Section $section = null, ?int $limit = null): array
Returns

the published ones, of one section when given, in order

QuestionRepository::findFeatured()

public function findFeatured(int $limit = 4): array
Returns

the featured ones first, then the most helpful

QuestionRepository::findOnePublished()

public function findOnePublished(string $slug): ?Question
public function search(string $term, int $limit = 20): array

A plain search in the questions and answers.

@return list<Question>

QuestionRepository::findSections()

public function findSections(): array
Returns

the sections that have a published question, in order

QuestionRepository::countDrafts()

public function countDrafts(): int

QuestionRepository::findDrafts()

public function findDrafts(int $limit = 5): array

Base\Faq\Service

AskNotifier class

final class AskNotifier AskNotifier.php:14

The administrators told of a question asked: the bell, and an e-mail, with a link to the draft.

AskNotifier::__construct()

public function __construct(readonly EntityManagerInterface $entityManager, readonly RoleHierarchyInterface $roles, readonly UrlGeneratorInterface $urls, readonly TranslatorInterface $translator)

AskNotifier::questionAsked()

public function questionAsked(Question $question): void

JsonLd class

final class JsonLd JsonLd.php:13

The questions as schema.org reads them: a FAQPage whose mainEntity is each Question with its acceptedAnswer. Plain arrays: the template encodes them. A question without an answer is left out - a FAQPage entry needs one.

JsonLd::page()

public function page(iterable $questions, ?string $url = null): ?array
Returns

null when no question has an answer

JsonLd::answer()

public static function answer(?string $content): string

An answer as a FAQPage takes it: its HTML kept to paragraphs, lists, links and emphasis, without attributes other than a link's address; an EditorJS document (JSON) turned into paragraphs and lists.

Base\Faq\Twig

FaqExtension class

final class FaqExtension extends AbstractExtension FaqExtension.php:11

What a host page asks the FAQ: a few questions for the home page, the sections for a menu.

FaqExtension::__construct()

public function __construct(readonly QuestionRepository $questions)

FaqExtension::getFunctions()

public function getFunctions(): array