Install
This is the repository archive. It installs, but the folder name will carry the branch suffix and updates will not flow.
Install straight from GitHub with WP-CLI:
wp plugin install https://github.com/nolidev-fr/primiko/archive/refs/heads/main.zipQuote request forms made for each trade: the right questions in the right order, with photos and the site address. A Simple message template replaces the contact form of the site.
A trade template is a JSON file in templates/: steps, fields, display conditions, help texts and the messages sent to the visitor. The format is described in docs/modele-metier.md. Nothing in the code depends on a given trade.
Layout
primiko.php: plugin header, constants, autoloader.includes/: one class per file (Primiko\Post_Typesisclass-post-types.php).Templatesreads and checks the templates,Conditionsevaluatesshow_ifon the server.Customizationskeeps what the business changed on its form (hidden steps, questions and answers, renamed texts, messages), as differences with the template.Rendererbuilds the form markup, shared byBlockandShortcode.RestexposesGET primiko/v1/tokenandPOST primiko/v1/submit, handled bySubmission, withTokenfor the signed single use token.Private_Uploadskeeps the photos out of the media library,Mailersends the emails,Entriesturns answers into labelled text.Form_SettingsandRequest_Vieware the admin boxes of a form and of a request,Request_Listthe columns, views and bulk actions of the list.Settingsholds the retention period,Retentiondeletes older requests every night,Privacyplugs requests into the personal data export and erase tools.
assets/form.jsandassets/form.css: visitor form, plain JavaScript, no build.src/block/: the block editor script,src/admin/: the questions editor of the form screen. Both built with@wordpress/scriptsintobuild/(webpack.config.jsadds the admin entry to the default build).includes/template-strings.php: generated table of the template texts and their translations, read when a template is translated.
WP-CLI
wp primiko list [--status=<new|done>] [--since=<YYYY-MM-DD>] [--format=<table|csv|json|count>]
wp primiko export [--status=<new|done>] [--since=<YYYY-MM-DD>] # JSON, every answer
wp primiko delete <id>... [--yes] # with the photos
wp primiko purge [--dry-run] # retention period, now
wp primiko templates [--format=<table|csv|json>]
Development
npm install
npm run build # block
npm run i18n:templates # after changing a template
composer install && composer lint
Translations: the sources are in English. Only languages/primiko.pot ships in the package, the French .po and .mo files are kept for local work.
Release
Tag X.Y.Z after updating the version in primiko.php (header and constant) and the stable tag in readme.txt. The deploy workflow builds the block and pushes to the WordPress.org SVN repository.