-
-
Notifications
You must be signed in to change notification settings - Fork 176
Adds docs for creating custom control panel #1909 revision #1939
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
stevepiercy
wants to merge
10
commits into
rohnsha0-control-panel
Choose a base branch
from
rohnsha0-control-panel-revision
base: rohnsha0-control-panel
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
10 commits
Select commit
Hold shift + click to select a range
579492d
Adds docs for creating custom control panel #1909 revision
stevepiercy e7413d4
remove extra space
stevepiercy c3a4efb
Blackify code, removing `u` designation since we're on Python 3
stevepiercy 0034ae6
s/Addon/add-on
stevepiercy 3beb688
Enhance documentation for creating control panels with `plonecli`, in…
rohnsha0 f5db4a5
Add new page for how to create a backend add-on
stevepiercy 735b878
Tidy up the Glossary
stevepiercy 72508d4
plonecli is in the user Python
stevepiercy 0b71881
- Improve flow
stevepiercy c89c927
Enhance documentation for creating control panels by adding notes on …
rohnsha0 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,150 @@ | ||
--- | ||
myst: | ||
html_meta: | ||
"description": "Create a backend add-on for Plone" | ||
"property=og:description": "Create a backend add-on for Plone" | ||
"property=og:title": "Create a backend add-on for Plone" | ||
"keywords": "Plone, create, add-on, plonecli, mr.bob, bobtemplates.plone, Cookieplone, buildout, backend" | ||
--- | ||
|
||
(create-backend-add-on-label)= | ||
|
||
# Create backend add-on | ||
|
||
This chapter describes how to create a backend add-on for Plone using {term}`plonecli`. | ||
|
||
```{note} | ||
This chapter does not apply for either of the following methods, because they create a backend add-on, as well as install Plone for development. | ||
|
||
- {doc}`/install/create-project-cookieplone` | ||
- `uvx cookieplone backend_addon` command | ||
|
||
Additionally, if you created a frontend add-on only project using the command `uvx cookieplone frontend_addon` and later realized you need a backend add-on to complement it, then you can create a new project using the command `uvx cookieplone` to generate both the frontend and backend add-ons, then finally move files from your existing project to the new one. | ||
``` | ||
|
||
|
||
## Prerequisites | ||
|
||
- You've installed Plone for development through either of the following methods. | ||
|
||
- {doc}`/admin-guide/install-buildout` | ||
- {doc}`/admin-guide/install-pip` | ||
|
||
- {term}`plonecli` is designed for developing backend add-ons—or packages—for Plone. | ||
|
||
You can install `plonecli` as any other Python package. | ||
Since it's used for development, it's advantageous to install it in your user environment, thus making it available to all your Plone projects. | ||
|
||
```shell | ||
python -m pip install plonecli --user | ||
``` | ||
|
||
|
||
## `plonecli` usage | ||
|
||
Change your working directory to the root of your Plone development installation for your project. | ||
Create the backend add-on with the following command. | ||
|
||
```shell | ||
plonecli create addon src/collective.myaddon | ||
``` | ||
|
||
Answer the prompts by either hitting the {kbd}`Enter` key to accept the default value, or entering a custom value. | ||
|
||
```console | ||
RUN: bobtemplates.plone:addon -O src/collective.myaddon | ||
|
||
Welcome to mr.bob interactive mode. Before we generate directory structure, some questions need to be answered. | ||
|
||
Answer with a question mark to display help. | ||
Values in square brackets at the end of the questions show the default value if there is no answer. | ||
|
||
|
||
--> Author's name [YOUR NAME]: | ||
|
||
--> Author's email [YOUR EMAIL]: | ||
|
||
--> Author's GitHub username: | ||
|
||
--> Package description [An add-on for Plone]: | ||
|
||
--> Do you want me to initialize a GIT repository in your new package? (y/n) [y]: | ||
|
||
--> Plone version [6.0.0]: | ||
|
||
--> Python version for virtualenv [python3]: | ||
|
||
--> Do you want me to activate VS Code support? (y/n) [y]: | ||
|
||
<snip> | ||
|
||
Should we run?: | ||
git add . | ||
git commit -m Create addon: collective.myaddon | ||
in: /path/to/buildout/project/src/collective.myaddon | ||
[y]/n: | ||
RUN: git add . | ||
RUN: git commit -m Create addon: collective.myaddon | ||
|
||
Generated file structure at /path/to/buildout/project/src/collective.myaddon/src/collective.myaddon | ||
``` | ||
|
||
You can now start developing your new add-on and add features to it. | ||
|
||
|
||
### Available templates | ||
|
||
To list the available {term}`mr.bob` templates, issue the following command. | ||
|
||
```shell | ||
plonecli -l | ||
``` | ||
|
||
You should see output similar to the following. | ||
|
||
```console | ||
- addon | ||
- behavior | ||
- content_type | ||
- controlpanel | ||
- form | ||
- indexer | ||
- mockup_pattern | ||
- portlet | ||
- restapi_service | ||
- site_initialization | ||
- subscriber | ||
- svelte_app | ||
- theme | ||
- theme_barceloneta | ||
- theme_basic | ||
- upgrade_step | ||
- view | ||
- viewlet | ||
- vocabulary | ||
- buildout | ||
``` | ||
|
||
|
||
(backend-add-on-subtemplates-label)= | ||
|
||
### Subtemplates | ||
|
||
You can add different features to your add-on through subtemplates, using any of the available mr.bob templates. | ||
You can use them multiple times to create different features of the same type, such as two different content types. | ||
|
||
First change your working directory into the root of your add-on. | ||
Then issue the command to add a feature as a subtemplate, and answer the prompts. | ||
|
||
```shell | ||
cd src/collective.myaddon/ | ||
plonecli add <TEMPLATE> | ||
``` | ||
|
||
```{seealso} | ||
The `plonecli` `README.md` has a section on [Usage](https://github.com/plone/plonecli?tab=readme-ov-file#usage). | ||
``` | ||
|
||
```{seealso} | ||
- {doc}`create-control-panel` | ||
``` |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
we dont need to have Plone installed for creating a backend addon (it is an optional).
creates a backend addon, changing the directory and running:
builds the addon which can be run and previewed using
runs the the plone server using classic ui from the Plone Version defined during creation of addon or the .mrbob global config
additionally, we can integrate the same addon using
local.cfg
file in buildouts