Skip to content

Commit

Permalink
Add missing php tags (sonata-project#5192)
Browse files Browse the repository at this point in the history
It is necessary to get syntax highlighting in docs.
  • Loading branch information
kunicmarko20 authored and greg0ire committed Aug 16, 2018
1 parent cc6302a commit b624fa7
Show file tree
Hide file tree
Showing 9 changed files with 54 additions and 0 deletions.
4 changes: 4 additions & 0 deletions docs/cookbook/recipe_creating_an_admin_with_annotations.rst
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,8 @@ like in the `getting started chapter`_:

.. code-block:: php
<?php
namespace App\Entity;
use Doctrine\ORM\Mapping as ORM;
Expand Down Expand Up @@ -59,6 +61,8 @@ like in the `getting started chapter`_:
.. code-block:: php
<?php
namespace App\Entity;
use Doctrine\ORM\Mapping as ORM;
Expand Down
16 changes: 16 additions & 0 deletions docs/cookbook/recipe_custom_action.rst
Original file line number Diff line number Diff line change
Expand Up @@ -133,6 +133,8 @@ If you want to add the current filter parameters to the redirect url you can add

.. code-block:: php
<?php
return new RedirectResponse($this->admin->generateUrl('list', ['filter' => $this->admin->getFilterParameters()]));
.. tip::
Expand Down Expand Up @@ -172,6 +174,8 @@ You have to add the new route in ``configureRoutes``:

.. code-block:: php
<?php
// ...
use Sonata\AdminBundle\Route\RouteCollection;
Expand All @@ -187,6 +191,8 @@ Next we have to add the action in ``configureListFields`` specifying the templat

.. code-block:: php
<?php
protected function configureListFields(ListMapper $listMapper)
{
$listMapper
Expand Down Expand Up @@ -282,6 +288,8 @@ Custom Action without Entity
Creating an action that is not connected to an Entity is also possible.
Let's imagine we have an import action. We register our route::

<?php

// ...
use Sonata\AdminBundle\Route\RouteCollection;

Expand All @@ -292,6 +300,8 @@ Let's imagine we have an import action. We register our route::

We add the controller action::

<?php

use Sonata\AdminBundle\Controller\CRUDController as Controller;
use Symfony\Component\HttpFoundation\Request;

Expand All @@ -306,6 +316,8 @@ Now, instead of adding the action to the form mapper, we can add it next to
the add button. In your admin class, overwrite the ``configureActionButtons``
method::

<?php

public function configureActionButtons($action, $object = null)
{
$list = parent::configureActionButtons($action, $object);
Expand All @@ -329,6 +341,8 @@ You can also add this action to your dashboard actions, you have to overwrite
the ``getDashboardActions`` method in your admin class and there are two
ways you can add action::

<?php

public function getDashboardActions()
{
$actions = parent::getDashboardActions();
Expand All @@ -348,6 +362,8 @@ Create a template for that button:
Or you can just pass values as array::

<?php

public function getDashboardActions()
{
$actions = parent::getDashboardActions();
Expand Down
4 changes: 4 additions & 0 deletions docs/cookbook/recipe_delete_field_group.rst
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@ field by hand, using the ``FormMapper``s ``remove`` method.

.. code-block:: php
<?php
use Sonata\UserBundle\Admin\Model\UserAdmin as SonataUserAdmin;
class UserAdmin extends SonataUserAdmin
Expand Down Expand Up @@ -34,6 +36,8 @@ of a whole form group: ``removeGroup``.

.. code-block:: php
<?php
use Sonata\UserBundle\Admin\Model\UserAdmin as SonataUserAdmin;
class UserAdmin extends SonataUserAdmin
Expand Down
4 changes: 4 additions & 0 deletions docs/cookbook/recipe_image_previews.rst
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,8 @@ we are manipulating form fields we do this from within ``ImageAdmin::configureFo

.. code-block:: php
<?php
class ImageAdmin extends AbstractAdmin
{
protected function configureFormFields(FormMapper $formMapper)
Expand Down Expand Up @@ -95,6 +97,8 @@ Admin class is embedded and use a different method:

.. code-block:: php
<?php
class ImageAdmin extends AbstractAdmin
{
protected function configureFormFields(FormMapper $formMapper)
Expand Down
2 changes: 2 additions & 0 deletions docs/cookbook/recipe_knp_menu.rst
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,8 @@ To add a custom controller entry in the admin menu:

Create your controller::

<?php

class BlogController
{
/**
Expand Down
4 changes: 4 additions & 0 deletions docs/cookbook/recipe_select2.rst
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,8 @@ To disable select2 on some ``select`` form element, set data attribute ``data-so

.. code-block:: php
<?php
use Sonata\AdminBundle\Form\Type\ModelType;
public function configureFormFields(FormMapper $formMapper)
Expand All @@ -59,6 +61,8 @@ to enable ``allowClear`` or ``data-sonata-select2-allow-clear = "false"`` to dis

.. code-block:: php
<?php
use Sonata\AdminBundle\Form\Type\ModelType;
public function configureFormFields(FormMapper $formMapper)
Expand Down
10 changes: 10 additions & 0 deletions docs/cookbook/recipe_sonata_admin_without_user_bundle.rst
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,8 @@ This represents your security user, you can read more about it `here <http://sym

.. code-block:: php
<?php
namespace App\Entity;
use Doctrine\ORM\Mapping as ORM;
Expand Down Expand Up @@ -74,6 +76,8 @@ more about it `here <http://symfony.com/doc/current/security/custom_provider.htm

.. code-block:: php
<?php
namespace App\Security;
use App\Entity\User;
Expand Down Expand Up @@ -144,6 +148,8 @@ A small login form that will basically just validate our data:

.. code-block:: php
<?php
namespace App\Form;
use Symfony\Component\Form\AbstractType;
Expand All @@ -169,6 +175,8 @@ more about it `here <https://symfony.com/doc/current/security/guard_authenticati

.. code-block:: php
<?php
namespace App\Security;
use App\Form\AdminLoginForm;
Expand Down Expand Up @@ -282,6 +290,8 @@ this will be handled by Symfony, but we still need to register that route.

.. code-block:: php
<?php
namespace App\Controller;
use Symfony\Bundle\FrameworkBundle\Controller\Controller;
Expand Down
4 changes: 4 additions & 0 deletions docs/cookbook/recipe_sortable_listing.rst
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,8 @@ First of all we are going to add a position field in our ``Client`` entity.

.. code-block:: php
<?php
/**
* @Gedmo\SortablePosition
* @ORM\Column(name="position", type="integer")
Expand Down Expand Up @@ -79,6 +81,8 @@ and use the default twig template provided in the ``pixSortableBehaviorBundle``

.. code-block:: php
<?php
$listMapper
->add('_action', null, [
'actions' => [
Expand Down
6 changes: 6 additions & 0 deletions docs/cookbook/recipe_sortable_sonata_type_model.rst
Original file line number Diff line number Diff line change
Expand Up @@ -97,6 +97,8 @@ Part 2 : Update the data model entities

Update the ``UserBundle\Entity\User.php`` entity with the following::

<?php

// ...

/**
Expand Down Expand Up @@ -158,6 +160,8 @@ Update the ``UserBundle\Entity\User.php`` entity with the following::

Update the ``UserBundle\Entity\Expectation.php`` entity with the following::

<?php

// ...

/**
Expand Down Expand Up @@ -353,6 +357,8 @@ Now update the ``UserBundle\Admin\UserAdmin.php`` by adding the ``sonata_type_mo

.. code-block:: php
<?php
/**
* {@inheritdoc}
*/
Expand Down

0 comments on commit b624fa7

Please sign in to comment.