Skip to content
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

[DOCS] fix grammar and typos ("Usage" documentation) #1033

Merged
merged 5 commits into from
Feb 12, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions Documentation/Usage/GettingStarted.rst
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@ Getting Started

Before you can start writing your own Fluid template files, you first need to make
sure that the environment is set up properly. If you are using a framework like
TYPO3, this might already the case. However, if you are starting from scratch, you
need do some preparations in PHP first:
TYPO3, this might already be the case. However, if you are starting from scratch, you
need to do some preparations in PHP first:

.. _create-view:

Expand Down
25 changes: 13 additions & 12 deletions Documentation/Usage/Structure.rst
Original file line number Diff line number Diff line change
Expand Up @@ -23,15 +23,16 @@ Layouts automatically have access to all variables defined within the template.
They don't have access to all template variables, instead the required variables
need to be provided to the partial when it is used.

When referring to these the names are used with an uppercase starting letter
(i.e. the name of the type). When referring to any file containing Fluid, the
word "templates" is sometimes used (i.e. lowercase starting letter) and in this
case refers to all the types above as a group.
.. note::
When referring to these files, the names are used with a uppercase starting
letter (i.e., the name of the type). When referring to any file containing Fluid, the
term "templates" is sometimes used (i.e., lowercase starting letter), and in this
case refers to all of the above types as a group.

Inside Templates and Partials a special `<f:section>` container can be used to
define sections that can be rendered using the `<f:render>` tag. Both Templates
and Partials may both contain and render sections, but Layouts may only
**render** sections.
Inside Templates and Partials, the :ref:`<f:section> ViewHelper <typo3fluid-fluid-section>`
can be used to define sections that can be rendered using the
:ref:`<f:render> ViewHelper <typo3fluid-fluid-render>`. Both Templates and Partials
may define and render sections, but Layouts may **only render** sections and partials.

.. _templatepaths-api:

Expand All @@ -57,7 +58,7 @@ Note that paths are *always defined as arrays*. In the default `TemplatePaths`
implementation, Fluid supports lookups in multiple template file locations -
which is very useful if you are rendering template files from another package
and wish to replace just a few template files. By adding your own template files
path *last in the paths arrays* Fluid will check those paths *first*.
path *last in the paths arrays*, Fluid will check those paths *first*.

.. _templates:

Expand Down Expand Up @@ -90,8 +91,8 @@ does not:
* When no Layout is used, *the template is rendered directly* and will output
everything not contained in an `<f:section>`
* When a Layout is used, *the Template itself is not rendered directly*.
Instead, the Template defines any number of `<f:section>` which contain the
pieces that will be rendered from the layout using `<f:render>`
Instead, the Template defines any number of `<f:section>` containers which
contain the pieces that will be rendered from the layout using `<f:render>`

You can choose freely between using a layout and not using one - even when
rendering templates in an MVC context, some templates might use layouts and
Expand Down Expand Up @@ -149,7 +150,7 @@ The partial then expects the variable `{address}` with all the properties
required to render an address; street, city, etc.

A partial may or may not contain `<f:section>`. If it does contain `<f:section>`
containers then the contents of those containers can be rendered anywhere,
containers, then the contents of those containers can be rendered anywhere,
including inside the Partial itself, by `<f:render partial="NameOfPartial" section="NameOfSection" />`.
Partials without sections can be rendered by just
`<f:render partial="NameOfPartial" />` (with or without `arguments`).
Expand Down
32 changes: 16 additions & 16 deletions Documentation/Usage/ViewHelpers.rst
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ How to use ViewHelpers

ViewHelpers are special tags in the template which provide more complex
functionality such as loops or special formatting of values. The functionality
of a ViewHelper is implemented in PHP, every ViewHelper has its own PHP class.
of a ViewHelper is implemented in PHP, and each ViewHelper has its own PHP class.

See the :ref:`ViewHelper Reference <viewhelper-reference>` for a complete
list of all available ViewHelpers.
Expand Down Expand Up @@ -48,7 +48,7 @@ in :ref:`Fluid ViewHelper Syntax <fluid-syntax-viewhelpers>`.
Registering/importing ViewHelpers
=================================

When you need to use third-party ViewHelpers in your templates there are multiple
When you need to use third-party ViewHelpers in your templates, there are multiple
equally valid options.

You can use the PHP API to register a namespace that should be
Expand Down Expand Up @@ -80,7 +80,7 @@ example: `foo` is the alias name).

.. _tagbased-viewhelpers:

Tag-Based ViewHelpers
Tag-based ViewHelpers
=====================

Tag-based ViewHelpers are special ViewHelpers that extend a different base class called
Expand Down Expand Up @@ -153,14 +153,14 @@ Of course, any variable containing a boolean can be supplied as well:

<my:viewHelper async="{isAsync}" />

It is also possible to cast a string to a boolean
It is also possible to cast a string to a boolean:

.. code-block:: xml

<my:viewHelper async="{myString as boolean}" />

For backwards compatibility empty strings still lead to the attribute
being omitted from the tag.
For backwards compatibility, empty strings still lead to the attribute
being omitted from the tag:

.. code-block:: xml

Expand All @@ -186,7 +186,7 @@ The generic and most used condition ViewHelper is :ref:`<f:if> <typo3fluid-fluid
then/else as argument
---------------------

Then and else can be defined as ViewHelper arguments:
You can define `then` and `else` as ViewHelper arguments:

.. code-block:: xml

Expand Down Expand Up @@ -243,21 +243,21 @@ If you want to learn more about a specific ViewHelper or if you are using a cust
ViewHelper that isn't documented, you can take a look at the ViewHelper source code, written
in PHP.

Each ViewHelper has a corresponding php file, which contains a class that describes the
Each ViewHelper has a corresponding PHP file, which contains a class that describes the
ViewHelper's arguments as well as its behavior in the template. Such classes are usually placed
in the `Vendor\Package\ViewHelpers` PHP namespace (where `Vendor` and `Package` are placeholders
for actual values) and follow the following naming convention:

* `f:format.raw` becomes PHP class :php:`TYPO3Fluid\Fluid\ViewHelpers\Format\RawViewHelper`
* `f:render` becomes PHP class :php:`TYPO3Fluid\Fluid\ViewHelpers\RenderViewHelper`
* `mypkg:custom.specialFormat` becomes PHP class
* `f:format.raw` results from the PHP class :php:`TYPO3Fluid\Fluid\ViewHelpers\Format\RawViewHelper`
* `f:render` results from the PHP class :php:`TYPO3Fluid\Fluid\ViewHelpers\RenderViewHelper`
* `mypkg:custom.specialFormat` results from the PHP class
:php:`My\Package\ViewHelpers\Custom\SpecialFormatViewHelper`, assuming you added
`xmlns:mpkg="http://typo3.org/ns/My/Package/ViewHelpers"` or alternative namespace
`xmlns:mpkg="http://typo3.org/ns/My/Package/ViewHelpers"` or an alternative namespace
registration (see above).

The arguments a ViewHelper supports will be verbosely registered in the
`initializeArguments()` function of each ViewHelper class. Inspect this method to
see the names, types, descriptions, required flag and default value of all
see the names, types, descriptions, required flags and default values of all
attributes. An example argument definition looks like this:

.. code-block:: php
Expand All @@ -275,9 +275,9 @@ Which translated to human terms means that we:
other class names. The *array of* syntax can also be used, for example `string[]` or
`Vendor\Package\MyClass[]`.
* Describe the argument's behavior in simple terms.
* The argument is not required (the 4th argument is :php:`false`).
* If the argument is not defined when calling the ViewHelper,
a default value of :php:`false` is assumed (5th argument).
* Define that the argument is not required (the 4th argument is :php:`false`).
* Set a default value of :php:`false` (5th argument), if the argument is not
provided when calling the ViewHelper.

The ViewHelper itself would then be callable like this:

Expand Down