In a nutshell, Elements are like core plugins. They’re included as part of the Textpattern CMS distribution, and thus have no install or uninstall mechanism, but can be turned on or off like plugins.
The point is to distance certain code from the core, help make the code more modular, and make it easier for users to customize a Textpattern CMS installation by disabling features they don’t need.
Disabling an Element means less code is loaded each time a page is viewed. For site owners, that means lower memory overhead, faster runtime, and fewer potential bugs and security issues. For developers, it means more modular code that’s easier to test, and easier for plugins and elements alike to hook into core functions.
A few other details of note
- Elements are always loaded from a file (in
textpattern/elements
), the code isn’t stored in the database - The list of elements is stored in a different table, and shown on a different panel (admin section, elements)
- Elements can be enabled and disabled, but certain important elements might be marked as ‘required’, and thus always active.
- Elements are only loaded when required (via the event/step fields)
The first Element off the block is the file download manager. All of the code relating to file downloads has been moved to textpattern/elements/"
. Though the Element UI isn’t working yet, it’s now possible to disable the file download code (front end, admin side and tag handlers).
The tentative naming convention for elements, beginning with the file download manager, is:
txp_*
for things that would previously have lived in textpattern/include/
tag_*
for code that would previously have lived in taghandlers.php
pub_*
for things (other than taghandlers) that would previously have lived in publish.php
or textpattern/publish/
(things like feed generation code, the comment POST
handler, CSS, etc).