TASK: Install new example extension

This commit is contained in:
Daniel Siepmann 2018-08-13 14:16:27 +02:00
parent e13a848108
commit 84f8bc9be7
Signed by: Daniel Siepmann
GPG key ID: 33D6629915560EF4
9 changed files with 3524 additions and 4 deletions

3
CodeExamples/.gitignore vendored Normal file
View file

@ -0,0 +1,3 @@
/private/
/public/
/vendor/

View file

@ -0,0 +1,46 @@
{
"repositories": [
{
"type": "path",
"url": "localPackages/*"
},
{
"type": "composer",
"url": "https://composer.typo3.org/"
}
],
"name": "website/typo3-extension-workshop",
"description": "Example TYPO3 installation for workshop",
"license": "GPL-2.0-or-later",
"require": {
"helhum/typo3-console": "^4.9.3 || ^5.2",
"helhum/typo3-secure-web": "^0.2.7",
"typo3-console/composer-auto-commands": "^0.2.0",
"typo3/cms-about": "^8.7.17",
"typo3/cms-belog": "^8.7.17",
"typo3/cms-beuser": "^8.7.17",
"typo3/cms-fluid-styled-content": "^8.7.17",
"typo3/cms-info": "^8.7.17",
"typo3/cms-info-pagetsconfig": "^8.7.17",
"typo3/cms-rte-ckeditor": "^8.7.17",
"typo3/cms-setup": "^8.7.17",
"typo3/cms-t3editor": "^8.7.17",
"typo3/cms-tstemplate": "^8.7.17",
"workshop/example-extension": "@dev"
},
"require-dev": {
"typo3/cms-lowlevel": "^8.7.17"
},
"extra": {
"typo3/cms": {
"root-dir": "private",
"web-dir": "public"
},
"helhum/typo3-console": {
"comment": "This option is not needed ay more for helhum/typo3-console 5.x",
"install-extension-dummy": false
}
},
"minimum-stability": "dev",
"prefer-stable": true
}

3321
CodeExamples/composer.lock generated Normal file

File diff suppressed because it is too large Load diff

View file

@ -0,0 +1,17 @@
{
"name": "workshop/example-extension",
"description": "Example for TYPO3 Extension Workshop.",
"type": "typo3-cms-extension",
"license": "GPL-2.0-or-later",
"authors": [
{
"name": "Daniel Siepmann",
"email": "coding@daniel-siepmann.de"
}
],
"autoload": {
"psr-4": {
"Workshop\\ExampleExtension\\": "Classes"
}
}
}

View file

@ -0,0 +1,18 @@
<?php
$EM_CONF['example_extension'] = [
'title' => 'Example extension',
'description' => 'Example for TYPO3 Extension Workshop.',
'category' => 'example',
'version' => '1.0.0',
'state' => 'stable',
'author' => 'Daniel Siepmann',
'author_email' => 'coding@daniel-siepmann.de',
'author_company' => 'Codappix',
'constraints' => [
'depends' => [
'typo3' => '8.7.0-8.7.999',
'php' => '7.0.0-7.2.999',
],
],
];

View file

@ -1,11 +1,72 @@
Extension
=========
First of all we have to understand what an extension is, in the context of TYPO3 CMS.
What is an extension?
---------------------
See :ref:`t3coreapi:extension-architecture` in TYPO3 Core API Reference.
TYPO3 is built only with extensions, there is no framework below. All features are
assigned to a specific extension. This way it's possible to build the TYPO3 that fits
the project needs.
An extension is something like `frontend` or `backend`, which provides the TYPO3
frontend or backend. It can also be `extbase` or `fluid` which provides and Framework
to build further extensions or an template engine.
Nowadays most installations also have a `site_` or `sitepackage` extensions, which
encapsulates the systems configuration and resources like assets and templates. Thus
an TYPO3 extension is the same as an composer package.
In this workshop we will concentrate of a "typical" extension that will provide a
plugin and custom record types. This can be installed into any compatible TYPO3
installation. A new record type will be added, which can be edited in the TYPO3
backend. Also a new plugin will be added which can be added as a content element and
displayed in frontend.
Structure of an extension
-------------------------
.. code-block:: plain
extension_key
├── Classes
│   ├── Command
│   │   └── ExampleCommandController.php
│   ├── Controller
│   │   └── ExampleController.php
│   └── Domain
│      └── Model
│         └── Example.php
├── composer.json
├── Configuration
│   ├── TCA
│   │   └── Overrides
│   │   └── tt_content.php
│   └── TypoScript
│   ├── constants.typoscript
│   └── setup.typoscript
├── Documentation
├── ext_conf_template.txt
├── ext_emconf.php
├── ext_localconf.php
├── ext_tables.php
├── readme.rst
└── Resources
   └── Private
   └── Templates
   └── Search
   └── Search.html
See :ref:`t3coreapi:extension-files-locations` in TYPO3 Core API Reference.
Further resources
-----------------
* :ref:`t3coreapi:extension-architecture` in TYPO3 Core API Reference.
* :ref:`t3coreapi:extension-files-locations` in TYPO3 Core API Reference.
* https://docs.typo3.org/typo3cms/ExtbaseFluidBook/Index.html

View file

@ -4,11 +4,59 @@ Start new extension
Necessary files
---------------
The only necessary file is :file:`ext_emconf.php`. This configures the *Extension
Manager*. Without this file, the Extension Manager would not recognize the extension
and would prevent installation.
.. literalinclude:: ../../CodeExamples/localPackages/example_extension/ext_emconf.php
:language: php
See :ref:`t3coreapi:extension-declaration` in TYPO3 Core API Reference.
.. admonition:: Task
So let's create a new folder and add the file.
Install extension
-----------------
Once we have created the first extension, we need to install the extension. There are
two ways for a local extension. Either placing the extension inside the installation,
or via composer.
.. admonition:: Task
Install the new extension.
Oldschool
^^^^^^^^^
Copy the extension to :file:`typo3conf/ext/`, and head over to *Extension Manager* to
activate the extension.
Via Composer
^^^^^^^^^^^^
Oldschool
^^^^^^^^^
The following project setup is suggested:
.. code-block:: text
.
├── composer.json
└── localPackages
   └── example_extension
:file:`composer.json`:
.. literalinclude:: ../../CodeExamples/composer.json
:language: json
In this case, we also need a :file:`composer.json` inside our extension, to make the
extension an composer package and allow the installation:
:file:`composer.json`:
.. literalinclude:: ../../CodeExamples/localPackages/example_extension/composer.json
:language: json
Thanks due ``typo3-console/composer-auto-commands`` our extension is activated already.

View file

@ -306,4 +306,6 @@ texinfo_documents = [
# Example configuration for intersphinx: refer to the Python standard library.
intersphinx_mapping = {'https://docs.python.org/': None}
intersphinx_mapping = {
't3coreapi': ('https://docs.typo3.org/typo3cms/CoreApiReference/', None),
}

View file

@ -1,10 +1,14 @@
Welcome to TYPO3 Extension Workshop
===================================
Topics:
This workshop is about the basics of TYPO3 extensions.
We will cover the following topics during the workshop, to build a foundation to
build custom extensions.
.. toctree::
:maxdepth: 2
:numbered:
Extension
StartNewExtension