Skip to content
This repository was archived by the owner on Mar 13, 2026. It is now read-only.

Commit 5aaa2bc

Browse files
committed
added content type interfaces
1 parent ee958dd commit 5aaa2bc

File tree

5 files changed

+733
-0
lines changed

5 files changed

+733
-0
lines changed

CHANGELOG-2.0.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ CHANGELOG - ZIKULA 2.0.x
1111

1212
- Features:
1313
- Added post configuration event for amending or extending menus. See `docs/Menu/MenuEvents.md` for the details.
14+
- Added common content types interfaces for extending the Content module.
1415

1516
- Vendor updates:
1617
- composer/ca-bundle updated from 1.1.1 to 1.1.2

src/lib/Zikula/Bundle/CoreBundle/Resources/config/services.yml

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,3 +26,16 @@ services:
2626
zikula.link_container_collector:
2727
class: Zikula\Core\LinkContainer\LinkContainerCollector
2828
arguments: ["@event_dispatcher"]
29+
30+
zikula.content_type.base:
31+
abstract: true
32+
arguments:
33+
- '@translator.default'
34+
- '@twig'
35+
- '@twig.loader'
36+
- '@?zikula_content_module.permission_helper'
37+
- '@zikula_core.common.theme.asset_helper'
38+
zikula.content_type.form.base:
39+
abstract: true
40+
arguments:
41+
- '@translator.default'
Lines changed: 57 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,57 @@
1+
<?php
2+
3+
/*
4+
* This file is part of the Zikula package.
5+
*
6+
* Copyright Zikula Foundation - http://zikula.org/
7+
*
8+
* For the full copyright and license information, please view the LICENSE
9+
* file that was distributed with this source code.
10+
*/
11+
12+
namespace Zikula\Common\Content;
13+
14+
use Symfony\Component\Form\AbstractType as AbstractType;
15+
use Symfony\Component\OptionsResolver\OptionsResolver;
16+
use Zikula\Common\Translator\TranslatorInterface;
17+
use Zikula\Common\Translator\TranslatorTrait;
18+
19+
/**
20+
* Abstract content type edit form type class.
21+
*/
22+
abstract class AbstractContentFormType extends AbstractType
23+
{
24+
use TranslatorTrait;
25+
26+
/**
27+
* @inheritDoc
28+
*/
29+
public function getBlockPrefix()
30+
{
31+
return 'zikula_contenttype_abstract';
32+
}
33+
34+
/**
35+
* @inheritDoc
36+
*/
37+
public function configureOptions(OptionsResolver $resolver)
38+
{
39+
$resolver
40+
->setDefaults([
41+
'context' => ContentTypeInterface::CONTEXT_EDIT
42+
])
43+
->setAllowedTypes('context', 'string')
44+
->setAllowedValues('context', [ContentTypeInterface::CONTEXT_EDIT, ContentTypeInterface::CONTEXT_TRANSLATION])
45+
;
46+
}
47+
48+
/**
49+
* Sets the translator.
50+
*
51+
* @param TranslatorInterface $translator Translator service instance
52+
*/
53+
public function setTranslator(TranslatorInterface $translator)
54+
{
55+
$this->translator = $translator;
56+
}
57+
}

0 commit comments

Comments
 (0)