TASK: Update docs pre workshop
This commit is contained in:
parent
fd69c91652
commit
ca8197a4de
9 changed files with 55 additions and 19 deletions
|
@ -1,3 +1,5 @@
|
||||||
|
.. _add-first-plugin:
|
||||||
|
|
||||||
Add first Plugin
|
Add first Plugin
|
||||||
================
|
================
|
||||||
|
|
||||||
|
@ -16,7 +18,7 @@ Still Plugins are a very typical thing to bring in features to your website.
|
||||||
The Plugin
|
The Plugin
|
||||||
----------
|
----------
|
||||||
|
|
||||||
We will start with a very basic plugin that will display a hardcoded string.
|
As mentioned, we will start with a simple example plugin to display "Hello World".
|
||||||
|
|
||||||
Register Plugin in Backend
|
Register Plugin in Backend
|
||||||
--------------------------
|
--------------------------
|
||||||
|
|
|
@ -95,7 +95,7 @@ book.
|
||||||
The whole ``settings`` array is passed into all templates, layouts and partials.
|
The whole ``settings`` array is passed into all templates, layouts and partials.
|
||||||
This way it's possible for integrators to provide arbitary information.
|
This way it's possible for integrators to provide arbitary information.
|
||||||
|
|
||||||
E.g. introduce a new namespace::
|
E.g. introduce a new namespace ``codappix`` with project specific settings::
|
||||||
|
|
||||||
plugin {
|
plugin {
|
||||||
tx_exampleextension {
|
tx_exampleextension {
|
||||||
|
@ -203,6 +203,8 @@ we can pre select the plugin.
|
||||||
|
|
||||||
See: https://docs.typo3.org/typo3cms/TSconfigReference/PageTsconfig/Mod.html#wizards
|
See: https://docs.typo3.org/typo3cms/TSconfigReference/PageTsconfig/Mod.html#wizards
|
||||||
|
|
||||||
|
Available TYPO3 Icons can be found here: https://typo3.github.io/TYPO3.Icons/
|
||||||
|
|
||||||
.. _configuration-view-paths:
|
.. _configuration-view-paths:
|
||||||
|
|
||||||
Adjusting view paths
|
Adjusting view paths
|
||||||
|
|
|
@ -17,7 +17,7 @@ TCA
|
||||||
|
|
||||||
Before we can do anything with Extbase, we need to configure TYPO3. The TCA (=Table
|
Before we can do anything with Extbase, we need to configure TYPO3. The TCA (=Table
|
||||||
Configuration Array) contains configuration for each database table. TYPO3 will
|
Configuration Array) contains configuration for each database table. TYPO3 will
|
||||||
generate the list view and edit forms from this configuration.
|
generate the list view and edit forms within the Backend from this configuration.
|
||||||
|
|
||||||
Extbase uses this configuration for mapping and database queries, together with
|
Extbase uses this configuration for mapping and database queries, together with
|
||||||
relation handling.
|
relation handling.
|
||||||
|
@ -49,6 +49,9 @@ Our new record will be an address record with the following fields:
|
||||||
|
|
||||||
* Country
|
* Country
|
||||||
|
|
||||||
|
Once we finished the TCA, we already can create new records. Only saving them does
|
||||||
|
not work, as we didn't setup the database yet.
|
||||||
|
|
||||||
.. note::
|
.. note::
|
||||||
|
|
||||||
By default new records are only allowed on pages of type "Folder".
|
By default new records are only allowed on pages of type "Folder".
|
||||||
|
@ -75,6 +78,7 @@ The example :file:`ext_tables.sql` is:
|
||||||
|
|
||||||
.. literalinclude:: ../../CodeExamples/localPackages/example_extension/ext_tables.sql
|
.. literalinclude:: ../../CodeExamples/localPackages/example_extension/ext_tables.sql
|
||||||
:language: sql
|
:language: sql
|
||||||
|
:linenos:
|
||||||
|
|
||||||
All further TYPO3 specific fields, like ``uid`` and ``pid`` are added by TYPO3 CMS since v9.
|
All further TYPO3 specific fields, like ``uid`` and ``pid`` are added by TYPO3 CMS since v9.
|
||||||
|
|
||||||
|
@ -106,6 +110,9 @@ Before v9, the file would look like:
|
||||||
KEY parent (pid)
|
KEY parent (pid)
|
||||||
);
|
);
|
||||||
|
|
||||||
|
We should now be able to create and save new records within the TYPO3 backend. Also
|
||||||
|
existing records should be listed, searchable and editable.
|
||||||
|
|
||||||
Model
|
Model
|
||||||
-----
|
-----
|
||||||
|
|
||||||
|
@ -119,7 +126,7 @@ our case this has to match the table name and is called
|
||||||
``Workshop\ExampleExtension\Domain\Model\Address`` and located at
|
``Workshop\ExampleExtension\Domain\Model\Address`` and located at
|
||||||
:file:`Classes/Domain/Model/Address.php`.
|
:file:`Classes/Domain/Model/Address.php`.
|
||||||
|
|
||||||
Each model is a PHP class structure like:
|
Each model is a PHP class, structured like:
|
||||||
|
|
||||||
.. literalinclude:: ../../CodeExamples/localPackages/example_extension/Classes/Domain/Model/Address.php
|
.. literalinclude:: ../../CodeExamples/localPackages/example_extension/Classes/Domain/Model/Address.php
|
||||||
:language: php
|
:language: php
|
||||||
|
@ -213,3 +220,26 @@ We could also configure the pid via TypoScript:
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Add new plugin
|
||||||
|
--------------
|
||||||
|
|
||||||
|
You might have noticed that the above controller is not the same as in our first
|
||||||
|
example. We therefore can add the controller to the existing plugin or add a new
|
||||||
|
plugin for this controller.
|
||||||
|
|
||||||
|
I would recommend to create a new plugin, to separate things. The process is not
|
||||||
|
explained again. If you struggle, take a look at :ref:`add-first-plugin` again.
|
||||||
|
|
||||||
|
Check everything
|
||||||
|
----------------
|
||||||
|
|
||||||
|
Once everything is set up, the following should be possible:
|
||||||
|
|
||||||
|
* Create, edit, search and delete records within TYPO3 Backend.
|
||||||
|
|
||||||
|
* List available records via Frontend Plugin.
|
||||||
|
|
||||||
|
Sounds like a lot of work for a small benefit? Right. If all you have to achieve is
|
||||||
|
this, you should not use Extbase but "pure" TYPO3. But we will extend the Extension
|
||||||
|
in the next step. Also this is about a first simple Extbase Extension, not how to use
|
||||||
|
TYPO3 the right way.
|
||||||
|
|
|
@ -12,11 +12,11 @@ TYPO3 is built only with extensions, there is no framework below. All features a
|
||||||
assigned to a specific extension. This way it's possible to build the TYPO3 that fits
|
assigned to a specific extension. This way it's possible to build the TYPO3 that fits
|
||||||
the project needs.
|
the project needs.
|
||||||
|
|
||||||
An extension is something like `frontend` or `backend`, which provides the TYPO3
|
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
|
frontend or backend. It can also be ``extbase`` which works as an Framework
|
||||||
to build further extensions or an template engine.
|
to build further extensions or ``fluid`` an template engine.
|
||||||
|
|
||||||
Nowadays most installations also have a `site_` or `sitepackage` extensions, which
|
Nowadays most installations also have a ``site_`` or ``sitepackage`` extensions, which
|
||||||
encapsulates the systems configuration and resources like assets and templates. Thus
|
encapsulates the systems configuration and resources like assets and templates. Thus
|
||||||
an TYPO3 extension is the same as an composer package.
|
an TYPO3 extension is the same as an composer package.
|
||||||
|
|
||||||
|
|
|
@ -11,9 +11,7 @@ If we have some time left, we can take a deeper look at some of these topics.
|
||||||
Outlook/Dependency-Injection
|
Outlook/Dependency-Injection
|
||||||
Outlook/Automated-Testing
|
Outlook/Automated-Testing
|
||||||
Outlook/Property-Mapper
|
Outlook/Property-Mapper
|
||||||
Outlook/Coding-Guideline
|
|
||||||
Outlook/Command-Controllers
|
Outlook/Command-Controllers
|
||||||
Outlook/Backend-Modules
|
Outlook/Backend-Modules
|
||||||
Outlook/Fluid/Custom-ViewHelper
|
Outlook/Fluid/Custom-ViewHelper
|
||||||
Outlook/Fluid/Concepts-of-Models
|
|
||||||
Outlook/Configuration/Mapping-DB
|
Outlook/Configuration/Mapping-DB
|
||||||
|
|
|
@ -1,2 +0,0 @@
|
||||||
Coding Guideline
|
|
||||||
================
|
|
|
@ -1,2 +0,0 @@
|
||||||
Fluid - Concepts of Models
|
|
||||||
==========================
|
|
|
@ -1,12 +1,16 @@
|
||||||
Start new extension
|
Start new extension
|
||||||
===================
|
===================
|
||||||
|
|
||||||
|
We will start with the simplest example ``Hello World``. Once we understood the
|
||||||
|
basics, we will create an "address" extension to manage a custom record.
|
||||||
|
|
||||||
Necessary files
|
Necessary files
|
||||||
---------------
|
---------------
|
||||||
|
|
||||||
The only necessary file is :file:`ext_emconf.php`. This configures the *Extension
|
Extensions consists of a folder and the single necessary file, which is
|
||||||
Manager*. Without this file, the Extension Manager would not recognize the extension
|
:file:`ext_emconf.php`. This configures the *Extension Manager*. Without this file,
|
||||||
and would prevent installation.
|
the Extension Manager would not recognize the extension and would prevent
|
||||||
|
installation.
|
||||||
|
|
||||||
.. literalinclude:: ../../CodeExamples/localPackages/example_extension/ext_emconf.php
|
.. literalinclude:: ../../CodeExamples/localPackages/example_extension/ext_emconf.php
|
||||||
:language: php
|
:language: php
|
||||||
|
@ -15,7 +19,9 @@ See :ref:`t3coreapi:extension-declaration` in TYPO3 Core API Reference.
|
||||||
|
|
||||||
.. admonition:: Task
|
.. admonition:: Task
|
||||||
|
|
||||||
So let's create a new folder and add the file.
|
So let's create a new folder and add the file within the folder.
|
||||||
|
|
||||||
|
In this example I'll use :file:`example_extension` as folder name.
|
||||||
|
|
||||||
Install extension
|
Install extension
|
||||||
-----------------
|
-----------------
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
Welcome to TYPO3 Extension Workshop
|
Welcome to TYPO3 Extension Workshop
|
||||||
===================================
|
===================================
|
||||||
|
|
||||||
This workshop is about the basics of TYPO3 extensions.
|
This workshop is about the basics of TYPO3 extensions, using Extbase and Fluid.
|
||||||
|
|
||||||
Some "rules" for the workshop
|
Some "rules" for the workshop
|
||||||
-----------------------------
|
-----------------------------
|
||||||
|
@ -17,6 +17,8 @@ Some "rules" for the workshop
|
||||||
|
|
||||||
* Ask questions as soon as possible. This way we have the context.
|
* Ask questions as soon as possible. This way we have the context.
|
||||||
|
|
||||||
|
* Tell me if you want less details.
|
||||||
|
|
||||||
* All materials are available on Github: https://github.com/DanielSiepmann/typo3-extension-workshop
|
* All materials are available on Github: https://github.com/DanielSiepmann/typo3-extension-workshop
|
||||||
|
|
||||||
* When should we make breaks? Any Smokers here?
|
* When should we make breaks? Any Smokers here?
|
||||||
|
|
Loading…
Reference in a new issue