Skip to content

contensio/plugin-faq

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

FAQ Manager - Contensio Plugin

Create groups of frequently asked questions and embed them anywhere on your site with a single line. Accordion display - each answer expands and collapses on click.


Features

  • FAQ sets - group related Q&A items under a named set
  • Unlimited items per set
  • Accordion display - single-open accordion; clicking a question expands the answer, clicking again collapses it
  • Embeddable by ID or slug - drop any FAQ set into any page, post, or widget area with one line
  • Admin CRUD - create, edit, and delete FAQ sets with their items in a single form
  • Inline item editing - add, edit, and remove Q&A items dynamically without leaving the form
  • Sort order - control which set appears first in listings
  • Auto-slug - slugs are generated from the title and kept unique automatically

How it works

  1. An admin creates a FAQ set in Tools → FAQ → New FAQ set, adds Q&A items, and saves.
  2. The set is embedded anywhere in a theme using @include('faq::partials.faq-set', ['faqSetId' => 1]).
  3. Visitors click a question to expand its answer. Clicking another question collapses the open one.

Installation

Via admin panel

Go to Plugins in your Contensio admin, find FAQ Manager, and click Install.

Via Composer

composer require contensio/plugin-faq

The plugin is auto-discovered. Go to Plugins in the admin and enable it. Migrations run automatically on first enable.


Embedding an FAQ set

By ID (recommended)

@include('faq::partials.faq-set', ['faqSetId' => 1])

By slug

@include('faq::partials.faq-set', ['faqSetSlug' => 'general-questions'])

The ID and slug are both shown on the FAQ sets list screen. Using an ID is more robust - it never changes even if the set title changes.

The embedded widget is self-contained and renders server-side. No JavaScript is needed for the data - Alpine.js handles only the accordion open/close state.


Admin

FAQ sets list (/account/faq)

Shows all FAQ sets with their item count and embed snippet. From here you can create, edit, or delete a set.

Create / edit form

Field Description
Title Set name, displayed above the accordion
Description Optional intro text shown below the title
Sort order Controls ordering in admin listings (lower = first)
Questions & Answers Add or remove items dynamically; minimum 1 item

Each Q&A item has a Question field (up to 500 characters) and an Answer textarea (up to 5,000 characters). Plain text only - line breaks are preserved in the rendered output.


Routes

Method URL Description
GET /account/faq Admin FAQ sets list
GET /account/faq/create New FAQ set form
POST /account/faq Create FAQ set
GET /account/faq/{id}/edit Edit FAQ set
PUT /account/faq/{id} Update FAQ set
DELETE /account/faq/{id} Delete FAQ set and all its items

Database

Two tables created by the migration:

faq_sets

Column Type Description
id bigint Primary key
title varchar(255) Set name
slug varchar(255) URL-safe identifier (unique)
description text Optional intro text (nullable)
sort_order smallint Display order
created_at / updated_at timestamp

faq_items

Column Type Description
id bigint Primary key
faq_set_id bigint FK → faq_sets.id (cascade delete)
question varchar(500) The question text
answer text The answer text (plain text, line breaks preserved)
sort_order smallint Display order within the set
created_at / updated_at timestamp

Requirements

  • PHP 8.2+
  • Contensio 2.0+
  • Alpine.js (included in all Contensio default themes)

License

AGPL-3.0-or-later - see LICENSE.

About

Create FAQ sets with grouped Q&A items. Accordion display. Embed any FAQ set on any page, post, or widget area with one line.

Resources

License

Stars

Watchers

Forks

Packages

 
 
 

Contributors