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

Adjust book to changes in 2.0 #451

Merged
merged 5 commits into from
Oct 7, 2019
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
104 changes: 0 additions & 104 deletions book/admin-interface.rst

This file was deleted.

6 changes: 2 additions & 4 deletions book/getting-started.rst
Original file line number Diff line number Diff line change
Expand Up @@ -86,11 +86,9 @@ untested:
+------------------------------+---------------------------------------+
| SQLite | no |
+------------------------------+---------------------------------------+
| Drizzle | untested |
+------------------------------+---------------------------------------+

The database connection information is stored as an environment variable called ``DATABASE_URL``.
For development, you can find and customize this inside ``.env``:
For development, you can find and customize this inside ``.env.local``:
Here is an example for using Sulu with MySQL:

.. code:: bash
Expand Down Expand Up @@ -131,7 +129,7 @@ will make sure the correct application is loaded.

.. code-block:: bash

SYMFONY_ENV=dev bin/console server:start
bin/console server:start

You can access the administration interface via http://127.0.0.1:8000/admin.
The default user and password is "admin".
Expand Down
15 changes: 7 additions & 8 deletions book/image-formats.rst
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ To show images on your website you should define different image formats for opt

Image formats can be defined in:

- `app/config/image-formats.xml`
- `config/image-formats.xml`

Or when you use the SuluThemeBundle you can define the formats in your theme folder:

Expand Down Expand Up @@ -44,7 +44,9 @@ The following example shows you different ways to define image formats:
Defining meta title
-------------------

You should define a meta title for every image format, since these titles are shown to the content manager in the administration interface when cropping the images.
You should define a meta title for every image format, since these titles are
shown to the content manager in the administration interface when cropping the
images.

.. code-block:: xml

Expand Down Expand Up @@ -77,12 +79,9 @@ Image Compression
Global image compression
^^^^^^^^^^^^^^^^^^^^^^^^

Images will not get compressed by default, if you upload them. You can set the
compression for images globally in the `app/config/config.yml`.

To set the compression for all images you have to add following lines to your

``config.yml``:
Images will not get compressed by default when you upload them. You can set the
compression for images globally e.g. in the `config/packages/sulu_media.yml`.
This file does not exist by default and must be created on your own.

.. code-block:: yaml

Expand Down
3 changes: 1 addition & 2 deletions book/index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -17,13 +17,12 @@ Be sure to know a thing or two about `Symfony`_. Sulu is based on Symfony and st
Getting Started <getting-started>
Templates <templates>
Twig <twig>
Content Architecture <content-architecture>
Webspaces <webspaces>
Image Formats <image-formats>
Localization <localization>
Smart Content <smart-content>
Themes <themes>
Content Architecture <content-architecture>
Admin Interface <admin-interface>

Lots of fun with Sulu. We hope you'll find the love we put in it while creating it.

Expand Down
12 changes: 6 additions & 6 deletions book/localization.rst
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
Adding localizations
====================

Sulu is built for companies with an international focus,
translating pages into multiple different languages is a very important task
for a content editor using Sulu. Sulu also considers the different variations
of a language among different countries. The combination of these two factors
is called a localization.
Sulu is built for companies with an international focus, so translating pages
into multiple different languages is a very important task for a content editor
using Sulu. Sulu also considers the different variations of a language among
different countries. The combination of these two factors is called a
localization.

Configuring webspace localizations
----------------------------------
Expand Down Expand Up @@ -62,7 +62,7 @@ For the developer the only touching points with localizations are the
configuration and the eventual use of a language switcher on the homepage.
For the language switcher the ``urls`` variable delivered to the twig template
can be used, which contains an associative array with the localization code
being the code and the value the URL to the current page in this language.
being the key and the value the URL to the current page in this language.

The template itself does not have to be adapted for usage with multiple
localizations. The twig variables are the same for every language, only the
Expand Down
18 changes: 9 additions & 9 deletions book/smart-content.rst
Original file line number Diff line number Diff line change
Expand Up @@ -57,13 +57,13 @@ defined which properties of the page should be returned in the array passed to
the twig template. The ``name`` of the parameter describes how the property
will be accessible in the twig template, and the value is the name of the
property on the page. Additionally there is the excerpt extension, which can be
used as well, there has just ``excerpt.`` to be prefixed. This extension is
available for all pages, so it is a safe bet. The problem with other properties
is that you have to make sure or at least check in the twig template if the
property exists.
used as well, there has ``excerpt.`` to be prefixed. This extension is available
for all pages, so it is a safe bet. The problem with other properties is that
you have to make sure or at least check in the twig template if the property
exists.

The value of the ``present_as`` property is injected into a dropdown, where the
content editor can choose between different styles, which of course have to be
content editor can choose between different styles, which have to be
implemented by the creator of the twig template. Popular options here are one
or two columns with variations like with or without images.

Expand All @@ -85,9 +85,9 @@ This way it is really simple to display this information using a twig template:

<div property="pages">
{% for page in content.pages %}
<div class="{{ view.pages.present_as }}">
<div class="{{ view.pages.presentAs }}">
<h2><a href="{{ sulu_content_path(page.url) }}">{{ page.title }}</a></h2>
<p>{{ page.description }}</p>
<p>{{ page.description|raw }}</p>
</div>
{% endfor %}
</div>
Expand Down Expand Up @@ -125,14 +125,14 @@ The smart content supports pagination, which can be activated with the param
{% if page-1 >= 1 %}
<li><a href="{{ sulu_content_path(content.url) }}?p={{ page-1 }}">&laquo;</a></li>
{% endif %}
{% if view.smartcontent.hasNextPage %}
{% if view.pages.hasNextPage %}
<li><a href="{{ sulu_content_path(content.url) }}?p={{ page+1 }}">&raquo;</a></li>
{% endif %}
</ul>

<div property="pages">
{% for page in content.pages %}
<div class="{{ view.pages.present_as }}">
<div class="{{ view.pages.presentAs }}">
<h2><a href="{{ sulu_content_path(page.url) }}">{{ page.title }}</a></h2>
<p>{{ page.description }}</p>
</div>
Expand Down
28 changes: 18 additions & 10 deletions book/templates.rst
Original file line number Diff line number Diff line change
Expand Up @@ -396,14 +396,14 @@ Content Blocks
--------------

Similar to sections, content blocks contain a list of fields. In content blocks,
however, the content managers themselves can add fields of different types and
however, the content managers themselves can add blocks of different types and
order them as they want:

.. figure:: ../img/templates-content-blocks.png

Content blocks are defined with the ``<block>`` element. Like properties, they
have a name that is used to access their content in Twig. The label of the
content block is -- you guessed it -- set in the ``<meta>`` element:
content block is set in the ``<meta>`` element:

.. code-block:: xml

Expand All @@ -415,13 +415,13 @@ content block is -- you guessed it -- set in the ``<meta>`` element:
<!-- ... -->
<properties>
<!-- ... -->
<block name="eventDetails">
<meta>
<title lang="en">Event Details</title>
</meta>
<block name="eventDetails">
<meta>
<title lang="en">Event Details</title>
</meta>

<!-- ... -->
</block>
<!-- ... -->
</block>
<!-- ... -->
</properties>
<!-- ... -->
Expand Down Expand Up @@ -505,8 +505,16 @@ type:
<!-- ... -->

<properties>
<property name="text" type="text_area"/>
<property name="author" type="contact_account_selection"/>
<property name="text" type="text_area">
<meta>
<title lang="en">Text</title>
</meta>
</property>
<property name="author" type="contact_account_selection">
<meta>
<title lang="en">Author</title>
</meta>
</property>
</properties>
</type>
</types>
Expand Down
48 changes: 16 additions & 32 deletions book/themes.rst
Original file line number Diff line number Diff line change
Expand Up @@ -30,32 +30,17 @@ First add the dependency to the `SuluThemeBundle`_ in your `composer.json` file.

composer require sulu/theme-bundle

To enable it add the following lines into the `app/AbstractKernel.php` and
`app/config/config.yml`.
To enable it add the following line into the `config/bundles.php` file:

.. code-block:: xml

abstract class AbstractKernel extends SuluKernel
{
/**
* {@inheritdoc}
*/
public function registerBundles()
{
$bundles = [
...
return [
...

new Sulu\Bundle\ThemeBundle\SuluThemeBundle(),
new Liip\ThemeBundle\LiipThemeBundle(),
Sulu\Bundle\ThemeBundle\SuluThemeBundle::class => ['all' => true],
];

...
];

...

return $bundles;
}
}
Add the following configuration in the file `config/packages/liip_theme.yaml`, which you have to create on your own:

.. code-block:: yaml

Expand All @@ -64,6 +49,9 @@ To enable it add the following lines into the `app/AbstractKernel.php` and
themes: ["default"]
active_theme: "default"
load_controllers: false
path_patterns:
app_resource:
- '%kernel.project_dir%/templates/themes/%%current_theme%%/%%template%%'

This will configure a default theme which can be enabled in the
`config/webspaces/<webspace>.xml` file by adding:
Expand All @@ -75,14 +63,10 @@ This will configure a default theme which can be enabled in the
Create a theme
--------------

Creating a theme is as easy as creating a new folder in the `Resources/themes/`
folder of your bundle with the name of the new theme. Afterwards you have to
fill this folder with all the used templates in the webspace. These templates
go into another subfolder in your theme, which you have to reference later. We
recommend to name this folder `templates`. It is also recommended to create
a folder `views` for more general templates, like the master template, an
error page, etc., and a folder `blocks` for reusable templates, like the seo
information.
To create a theme you have to create a new folder in the `templates/themes`
folder of your application with the name of the new theme. Afterwards you have
to fill this folder with all the used templates in the webspace. These templates
go into another subfolder in your theme, which you have to reference later.

For more concrete information about the structure of these templates you should
check the :doc:`templates`.
Expand All @@ -92,9 +76,9 @@ Enable the theme
----------------

For resolving the templates we are using the `LiipThemeBundle`_, which requires
you to register your themes. You can do that in your application configuration
located at `app/config/config.yml`. Add the name of your theme folder to the
following list:
you to register your themes. You can do that in your LiipThemeBundle
configuration located at `config/packages/liip_theme.yml`. Add the name of your
theme folder to the following list:

.. code-block:: yaml

Expand Down
Loading