Skip to content

Commit

Permalink
Merge 2b93c1b into f14ddd5
Browse files Browse the repository at this point in the history
  • Loading branch information
Numkil committed Jan 24, 2019
2 parents f14ddd5 + 2b93c1b commit 9d0f60d
Show file tree
Hide file tree
Showing 261 changed files with 3,348 additions and 1,417 deletions.
2 changes: 0 additions & 2 deletions .travis.yml
Expand Up @@ -7,8 +7,6 @@ cache:
matrix:
fast_finish: true
include:
- php: 5.6
- php: 7.0
- php: 7.1
- php: 7.2
env: COVERAGE=true CODECEPTION_FLAGS="--coverage --coverage-xml"
Expand Down
2 changes: 1 addition & 1 deletion UPGRADE-5.1.md
Expand Up @@ -82,7 +82,7 @@ NodeBundle
* The unused `WidgetsController::selectNodesLazySearch` action is deprecated and will be removed in 6.0.
* Injecting the container in the `SlugRouter` is deprecated and will be removed in 6.0. Inject the required services instead.
* The `service` method of `Kunstmaan\NodeBundle\Entity\PageInterface` is deprecated and will be removed in 6.0. Implement the `Kunstmaan\NodeBundle\Controller\SlugActionInterface`
and use the `getControllerAction` method to specify a controller action with your custom page logic instead.
and use the `getControllerAction` method to specify a controller action with your custom page logic instead.
* Button to export page template is now disabled by default. You can enable it by setting the `enable_export_page_template` value to true inside the `kunstmaan_node` configuration.
* Injecting the `TemplateEngine` as the first argument in the `RenderContextListener` is deprecated and will be removed in 6.0. Remove the `TemplateEngine` as the first service argument.

Expand Down
28 changes: 28 additions & 0 deletions UPGRADE-5.2.md
@@ -0,0 +1,28 @@
UPGRADE FROM 5.1 to 5.2
=======================

General
-------

* We don't depend on the `symfony/symfony` package anymore, instead the individual `symfony/*` packages are added as dependencies.
If your code depends on other symfony packages than the ones we require, add them to your project `composer.json`.
* The `symfony/monolog-bundle` package was removed as it was no dependency of the kunstmaan cms. If you use this in your project, add the `"symfony/monolog-bundle": "~2.8|~3.0"` constraint to your project `composer.json`.

AdminBundle
-----------

* We've removed the `RoleInterface` on the `Kunstmaan\AdminBundle\Entity\Group` entity if you run your code on symfony 4.
The interface was deprecated and removed in symfony 4. If you used this interface to check the `Group` entity change it to
the `FOS\UserBundle\Model\GroupInterface`. The `Group` entity won't change if you run on symfony 3.4 but it's adviced to make
this change already.

NodeSearchBundle
----------------

* Depending on the service container to retrieve searchers is deprecated and will be removed in 6.0. Tag your custom node
searchers with the "kunstmaan_node_search.node_searcher" tag, to have them available for the NodeSearchBundle.

NodeBundle
----------

* Added the ability to split up an entity into multiple tabs. See [docs/bundles/node-bundle/entity-tabs.md](docs/bundles/node-bundle/entity-tabs.md)
40 changes: 31 additions & 9 deletions composer.json
Expand Up @@ -16,16 +16,38 @@
}
],
"require": {
"php": ">=5.6.0",
"symfony/symfony": "~3.4",
"php": "^7.1",
"symfony/acl-bundle": "^1.0",
"symfony/config": "^3.4|^4.0",
"symfony/console": "^3.4|^4.0",
"symfony/dependency-injection": "^3.4|^4.0",
"symfony/dom-crawler": "^3.4|^4.0",
"symfony/event-dispatcher": "^3.4|^4.0",
"symfony/filesystem": "^3.4|^4.0",
"symfony/finder": "^3.4|^4.0",
"symfony/framework-bundle": "^3.4|^4.0",
"symfony/form": "^3.4|^4.0",
"symfony/http-foundation": "^3.4|^4.0",
"symfony/http-kernel": "^3.4|^4.0",
"symfony/inflector": "^3.4|^4.0",
"symfony/options-resolver": "^3.4|^4.0",
"symfony/property-access": "^3.4|^4.0",
"symfony/routing": "^3.4|^4.0",
"symfony/security": "^3.4|^4.0",
"symfony/security-acl": "^2.8|^3.0",
"symfony/serializer": "^3.4|^4.0",
"symfony/templating": "^3.4|^4.0",
"symfony/translation": "^3.4|^4.0",
"symfony/twig-bundle": "^3.4|^4.0",
"symfony/validator": "^3.4|^4.0",
"symfony/yaml": "^3.4|^4.0",
"symfony/css-selector": "^3.4|^4.0",
"doctrine/orm": "^2.5",
"doctrine/dbal": "^2.5",
"doctrine/doctrine-bundle": "^1.6",
"doctrine/doctrine-cache-bundle": "^1.2",
"doctrine/doctrine-migrations-bundle": "^1.3",
"symfony/swiftmailer-bundle": "^2.3|^3.0",
"symfony/monolog-bundle": "~2.8|~3.0",
"symfony/security-acl": "~2.8|~3.0",
"sensio/framework-extra-bundle": "^5.0",
"incenteev/composer-parameter-handler": "^2.0",

Expand All @@ -38,19 +60,19 @@
"gedmo/doctrine-extensions": "^2.4.34",
"doctrine/doctrine-fixtures-bundle": "~2.2",
"stof/doctrine-extensions-bundle": "~1.1",
"liip/imagine-bundle": "~1.7",
"liip/imagine-bundle": "^2.0",
"imagine/imagine": "~0.6",
"knplabs/knp-gaufrette-bundle": "~0.1",
"symfony-cmf/routing-bundle": "~2.0",
"fpn/doctrine-extensions-taggable": "~0.9",
"sensio/generator-bundle": "~3.0",
"twig/twig": "^1.12|^2.0",
"twig/twig": "^1.36|^2.6",
"twig/extensions": "~1.0",
"egulias/email-validator": "^1.2.8|^2.0",
"box/spout": "^2.5",
"ruflin/elastica": "^5.1|^6.0",
"behat/transliterator": "~1.2",
"defuse/php-encryption": "v2.1.0"
"defuse/php-encryption": "v2.1.0",
"kunstmaan/sensio-generator-bundle": "^3.2"
},
"require-dev": {
"behat/behat": "3.1.0rc1",
Expand Down Expand Up @@ -105,7 +127,7 @@
},
"extra": {
"branch-alias": {
"dev-master": "5.1-dev"
"dev-master": "5.2-dev"
}
}
}
235 changes: 235 additions & 0 deletions docs/bundles/node-bundle/entity-tabs.md
@@ -0,0 +1,235 @@
# Entity tabs

Are there too many fields in your form, when you're trying to edit a page? Would it make more sense to split your entity up into logical sections?
By implementing the PageTabInterface, you can split your page or entity up into multiple tabs.

## Usage

Start by implementing PageTabInterface. This interface forces you to implement the method ```getTabs()```.
This method expects you to return an array of ```Kunstmaan\NodeBundle\ValueObject\PageTab```.
In the value object you have to define the tabs internal name, display name and form type class. Optionally you can also set its position, to be able to control the order in the tab menu.

Imagine you have a ```AppBundle\Entity\Product``` entity, and you would like to split the display of the fields up into three sections: Product information, categories and pricing.
Then you would have the following entity:

```php
<?php

namespace AppBundle\Entity;

use Doctrine\ORM\Mapping as ORM;
use Kunstmaan\NodeBundle\Entity\AbstractPage;
use Kunstmaan\NodeBundle\Entity\PageTabInterface;
use Kunstmaan\NodeBundle\ValueObject\PageTab;
use Kunstmaan\MediaBundle\Entity\Media;
use AppBundle\Entity\Category;

/**
* @ORM\Table(name="product")
* @ORM\Entity()
*/
class Product extends AbstractPage implements PageTabInterface {
/**
* @var Media
*
* @ORM\ManyToOne(targetEntity="Kunstmaan\MediaBundle\Entity\Media")
* @ORM\JoinColumns({
* @ORM\JoinColumn(name="product_image_id", referencedColumnName="id")
* })
*/
private $productImage;

/**
* @var string
*
* @ORM\Column(name="first_name", type="string", length=255, nullable=false)
*/
private $productDescription;

/**
* @var Category[]
*
* @ORM\ManyToMany(targetEntity="AppBundle\Entity\Category", mappedBy="products")
*/
private $categories;

/**
* @var string
*
* @ORM\Column(type="decimal", name="price_excl", precision=12, scale=2, nullable=false)
*/
private $priceExcl;

/**
* @var string
*
* @ORM\Column(type="decimal", name="vat", precision=12, scale=2, nullable=false)
*/
private $vat;

/**
* .. getters and setters here
*/

/**
* @return array
*/
public function getPossibleChildTypes()
{
return [];
}

/**
* @return string
*/
public function getDefaultAdminType()
{
return AppBundle\Form\ProductType::class;
}

public function getTabs() {
return [
new PageTab(
'product_categories', //Internal name of the tab
'Categories', //Title displayed in the tab
AppBundle\Form\ProductCategoriesType::class, //Form type class containing the fields you wish to edit in this tab
1 //position of the tab
),
new PageTab(
'product_pricing', //Internal name of the tab
'Pricing', //Title displayed in the tab
AppBundle\Form\ProductPricingType::class, //Form type class containing the fields you wish to edit in this tab
2 //position of the tab
)
];
}
}
```

Now that you have your entity, all there is left is to define the forms for this entity. The three forms in requested in the entity could look like this:

```php
<?php

namespace Esites\WebsiteBundle\Form;

use Kunstmaan\AdminBundle\Form\WysiwygType;
use Kunstmaan\MediaBundle\Form\Type\MediaType;
use Kunstmaan\NodeBundle\Form\PageAdminType;
use Symfony\Component\Form\FormBuilderInterface;
use Symfony\Component\OptionsResolver\OptionsResolver;
use AppBundle\Entity\Product;

/**
* This form will be displayed in the first tab "Content", which is defined in AppBundle\Entity\Product:getDefaultAdminType()
*/
class ProductType extends PageAdminType
{
public function buildForm(FormBuilderInterface $builder, array $options)
{
parent::buildForm($builder, $options);

$builder
->add('productImage', MediaType::class, [
'mediatype' => 'image',
'required' => true,
])
->add('productDescription', WysiwygType::class, [
'required' => true,
])
;
}

public function configureOptions(OptionsResolver $resolver)
{
$resolver->setDefaults([
'data_class' => Product::class,
]);
}
}
```

```php
<?php

namespace Esites\WebsiteBundle\Form;

use Kunstmaan\NodeBundle\Form\PageAdminType;
use Symfony\Bridge\Doctrine\Form\Type\EntityType;
use Symfony\Component\Form\FormBuilderInterface;
use Symfony\Component\OptionsResolver\OptionsResolver;
use AppBundle\Entity\Product;
use AppBundle\Entity\Category;

/**
* This form will be displayed in the second tab "Categories", which is defined in AppBundle\Entity\Product:getTabs()
*/
class ProductCategoriesType extends PageAdminType
{
public function buildForm(FormBuilderInterface $builder, array $options)
{
parent::buildForm($builder, $options);

$builder
->add('categories', EntityType::class, [
'class' => Category::class,
'multiple' => true,
'required' => true,
])
;
}

public function configureOptions(OptionsResolver $resolver)
{
$resolver->setDefaults([
'data_class' => Product::class,
]);
}
}
```

```php
<?php

namespace Esites\WebsiteBundle\Form;

use Kunstmaan\NodeBundle\Form\PageAdminType;
use Symfony\Component\Form\Extension\Core\Type\NumberType;
use Symfony\Component\Form\FormBuilderInterface;
use Symfony\Component\OptionsResolver\OptionsResolver;
use AppBundle\Entity\Product;

/**
* This form will be displayed in the third tab "Pricing", which is defined in AppBundle\Entity\Product:getTabs()
*/
class ProductCategoriesType extends PageAdminType
{
public function buildForm(FormBuilderInterface $builder, array $options)
{
parent::buildForm($builder, $options);

$builder
->add('priceExcl', NumberType::class, [
'required' => true
])
->add('vat', NumberType::class, [
'required' => true
])
;
}

public function configureOptions(OptionsResolver $resolver)
{
$resolver->setDefaults([
'data_class' => Product::class,
]);
}
}
```

## Result

After implementing all of this, Kunstmaan will show the following tabs when editing the product:

| Content | Categories | Pricing | Permissions | SEO | Social |
| ------- | ----------- | ------- | ----------- | --- | ------ |
2 changes: 1 addition & 1 deletion docs/installation/system-requirements.md
@@ -1,7 +1,7 @@
# System Requirements

* PHP
* minimum version is PHP 5.6, but also working great with PHP 7.0 or PHP 7.1.
* minimum version is PHP 7.1
* JSON needs to be enabled
* ctype needs to be enabled
* curl needs to be enabled
Expand Down
2 changes: 1 addition & 1 deletion docs/introduction/index.md
Expand Up @@ -30,7 +30,7 @@ Starting fresh has a lot of advantages and going further we defined the basic pr
2. Added on top of the framework we included a lot of **community components** that provide our extended framework with functionality like Image resizing, pagination, user management, an advanced router, etc.
3. And we wrap all this into a **user friendly admin interface with content management** functionalities.

We are able to support PHP 5.4 and up, and all Symfony versions since 2.3. We constantly test and adapt to be able to run the latest and greatest from Symfony and the community.
We support PHP 7.1 and up, and Symfony 3.4. We constantly test and adapt to be able to run the latest and greatest from Symfony and the community.

# Open Source

Expand Down
2 changes: 1 addition & 1 deletion src/Kunstmaan/AdminBundle/Controller/DefaultController.php
Expand Up @@ -6,7 +6,7 @@
use Kunstmaan\AdminBundle\Entity\DashboardConfiguration;
use Kunstmaan\AdminBundle\FlashMessages\FlashTypes;
use Kunstmaan\AdminBundle\Form\DashboardConfigurationType;
use Sensio\Bundle\FrameworkExtraBundle\Configuration\Route;
use Symfony\Component\Routing\Annotation\Route;
use Sensio\Bundle\FrameworkExtraBundle\Configuration\Template;
use Symfony\Bundle\FrameworkBundle\Controller\Controller;
use Symfony\Component\HttpFoundation\RedirectResponse;
Expand Down
Expand Up @@ -6,7 +6,7 @@
use Kunstmaan\AdminBundle\AdminList\ExceptionAdminListConfigurator;
use Kunstmaan\AdminBundle\Entity\Exception;
use Kunstmaan\AdminListBundle\Controller\AdminListController;
use Sensio\Bundle\FrameworkExtraBundle\Configuration\Route;
use Symfony\Component\Routing\Annotation\Route;
use Symfony\Component\HttpFoundation\RedirectResponse;
use Symfony\Component\HttpFoundation\Request;

Expand Down

0 comments on commit 9d0f60d

Please sign in to comment.