Skip to content

Commit

Permalink
moved reader and list config to own bundle
Browse files Browse the repository at this point in the history
  • Loading branch information
koertho committed Sep 26, 2018
1 parent ac13cf0 commit 03dfd18
Show file tree
Hide file tree
Showing 16 changed files with 39 additions and 237 deletions.
14 changes: 7 additions & 7 deletions README.md
@@ -1,4 +1,4 @@
# YouTube
huh.list.backend.module# YouTube

[![](https://img.shields.io/packagist/v/heimrichhannot/contao-youtube-bundle.svg)](https://packagist.org/packages/heimrichhannot/contao-youtube-bundle)
[![](https://img.shields.io/packagist/dt/heimrichhannot/contao-youtube-bundle.svg)](https://packagist.org/packages/heimrichhannot/contao-youtube-bundle)
Expand Down Expand Up @@ -26,6 +26,10 @@ It provides support for content elements and news items.

## Technical instruction

### Upgrade major version or from heimrichhannot/contao-youtube

See [Upgrade.md](UPGRADE.md)

### Add to list and reader item templates

For usage with [List-](https://github.com/heimrichhannot/contao-list-bundle) and [Readerbundle](https://github.com/heimrichhannot/contao-reader-bundle) you first need to add the config elements in List- and/or Reader config.
Expand Down Expand Up @@ -66,9 +70,5 @@ Youtube videos can be added to news templates with ease. Just add the following

To use preview images from youtube, you have to generate an API key (https://developers.google.com/youtube/v3/getting-started) and place it in the contao settings.

## Upgrade notice from heimrichhannot/contao-youtube

- After update, save your root-pages in back end mode again to update template names
- Declare an Youtube-API Key in tl_settings or tl_page (otherwise preview image download wont work)
- The modal windows for privacy dialog or modalvideo require additional css, that is not delivered by the bundle. Markup fits [Bootstrap](http://getbootstrap.com/) modal window css, so you are well-advised to use the css from that framework.
- If you were using custom youtube `.html5` templates, migrate them to `.html.twig` templates, if you need help: check the default templates
## Integrations/Extension
- Integration with [Contao Reader Bundle](https://github.com/heimrichhannot/contao-reader-bundle): [Contao Youtube Reader Bundle](https://github.com/heimrichhannot/contao-youtube-reader-bundle)
23 changes: 23 additions & 0 deletions UPGRADE.md
@@ -0,0 +1,23 @@
# Upgrade

## 1.* to 2.0

### Integrations
* moved reader bundle integration to own [bundle](https://github.com/heimrichhannot/contao-youtube-reader-bundle)

### Constants
* Removed `ConfigFactory::CONTEXT_READER_BUNDLE` (use `CONTEXT_TWIG` instead)

### Classes
* moved `YouTubeReaderConfigElementType` to own bundle (see Integrations)

### DCA
* moved `tl_reader_config_element` dca and languages to own bundle (see integrations)

## heimrichhannot/contao-youtube to youtube bundle 1.0

- After update, save your root-pages in back end mode again to update template names
- Declare an Youtube-API Key in tl_settings or tl_page (otherwise preview image download wont work)
- The modal windows for privacy dialog or modalvideo require additional css, that is not delivered by the bundle. Markup fits [Bootstrap](http://getbootstrap.com/) modal window css, so you are well-advised to use the css from that framework.
- If you were using custom youtube `.html5` templates, migrate them to `.html.twig` templates, if you need help: check the default templates

53 changes: 0 additions & 53 deletions src/ConfigElementType/YouTubeListConfigElementType.php

This file was deleted.

54 changes: 0 additions & 54 deletions src/ConfigElementType/YoutubeReaderConfigElementType.php

This file was deleted.

6 changes: 2 additions & 4 deletions src/Configuration/ConfigFactory.php
Expand Up @@ -12,10 +12,9 @@

class ConfigFactory
{
const CONTEXT_TWIG = 'twig';
const CONTEXT_CONTENT_ELEMENT = 'contentElement';
const CONTEXT_FRONTEND_MODULE = 'frontendModule';
const CONTEXT_READER_BUNDLE = 'readerBundle';
const CONTEXT_LIST_BUNDLE = 'listBundle';

/**
* @var ContaoFrameworkInterface
Expand All @@ -38,8 +37,7 @@ public function __construct(ContaoFrameworkInterface $framework)
public function createConfig(string $context, array $config = null)
{
switch ($context) {
case static::CONTEXT_READER_BUNDLE:
case static::CONTEXT_LIST_BUNDLE:
case static::CONTEXT_TWIG:
return new YoutubeTwigConfig($this->framework, $config);
case static::CONTEXT_CONTENT_ELEMENT:
case static::CONTEXT_FRONTEND_MODULE:
Expand Down
17 changes: 4 additions & 13 deletions src/ContaoManager/Plugin.php
Expand Up @@ -25,7 +25,10 @@ class Plugin implements BundlePluginInterface, ExtensionPluginInterface
public function getBundles(ParserInterface $parser)
{
return [
BundleConfig::create(HeimrichHannotContaoYoutubeBundle::class)->setLoadAfter([ContaoCoreBundle::class, 'multi_column_editor']),
BundleConfig::create(HeimrichHannotContaoYoutubeBundle::class)->setLoadAfter([
ContaoCoreBundle::class,
'multi_column_editor',
]),
];
}

Expand All @@ -46,18 +49,6 @@ public function getExtensionConfig($extensionName, array $extensionConfigs, Cont
$extensionConfigs,
__DIR__.'/../Resources/config/config_encore.yml'
);
$extensionConfigs = ContainerUtil::mergeConfigFile(
'huh_list',
$extensionName,
$extensionConfigs,
__DIR__.'/../Resources/config/huh_list.yml'
);
$extensionConfigs = ContainerUtil::mergeConfigFile(
'huh_reader',
$extensionName,
$extensionConfigs,
__DIR__.'/../Resources/config/huh_reader.yml'
);

return $extensionConfigs;
}
Expand Down
4 changes: 0 additions & 4 deletions src/Resources/config/huh_list.yml

This file was deleted.

4 changes: 0 additions & 4 deletions src/Resources/config/huh_reader.yml

This file was deleted.

21 changes: 0 additions & 21 deletions src/Resources/contao/dca/tl_reader_config_element.php

This file was deleted.

10 changes: 0 additions & 10 deletions src/Resources/contao/languages/de/tl_list_config_element.php

This file was deleted.

This file was deleted.

10 changes: 0 additions & 10 deletions src/Resources/contao/languages/en/tl_list_config_element.php

This file was deleted.

10 changes: 0 additions & 10 deletions src/Resources/contao/languages/en/tl_reader_config_element.php

This file was deleted.

20 changes: 1 addition & 19 deletions src/Resources/translations/messages.de.yml
Expand Up @@ -13,22 +13,4 @@ huh.youtube:
default: Video anzeigen
play: Video abspielen
window: Video in neuen Fenster öffnen
article: Videobeitrag

# DCA
huh.list:
tl_list_config_element.field:
typeSelectorField.youtube:
name: YouTube Selektor Element
desc: Wählen Sie hier das Feld aus, welches den boolschen Selektor für das YouTube Feld enthält.
typeField.youtube:
name: YouTube Feld
desc: Wählen Sie hier das Feld aus, welches die ID des YouTube Video enthält.
huh.reader:
tl_reader_config_element.field:
typeSelectorField.youtube:
name: YouTube Selektor Element
desc: Wählen Sie hier das Feld aus, welches den boolschen Selektor für das YouTube Feld enthält.
typeField.youtube:
name: YouTube Feld
desc: Wählen Sie hier das Feld aus, welches die ID des YouTube Video enthält.
article: Videobeitrag
20 changes: 1 addition & 19 deletions src/Resources/translations/messages.en.yml
Expand Up @@ -13,22 +13,4 @@ huh.youtube:
default: Show video
play: Play video
window: Open video in new window
article: video post

# DCA
huh.list:
tl_list_config_element.field:
typeSelectorField.youtube:
name: YouTube selector element
desc: Choose the field containing the boolean selector for the youtube field.
typeField.youtube:
name: YouTube field
desc: Choose the field containing the Youtube Video ID.
huh.reader:
tl_reader_config_element.field:
typeSelectorField.youtube:
name: YouTube selector element
desc: Choose the field containing the boolean selector for the youtube field.
typeField.youtube:
name: YouTube field
desc: Choose the field containing the Youtube Video ID.
article: video post
2 changes: 1 addition & 1 deletion src/Video/YoutubeVideoTemplateDataTrait.php
Expand Up @@ -145,7 +145,7 @@ public function getYoutubePreviewImage(bool $cache = true): string
try {
$response = json_decode($result);

if ($response->error || !is_array($response->items) || empty($response->items)) {
if ($response->error || !\is_array($response->items) || empty($response->items)) {
return '';
}

Expand Down

0 comments on commit 03dfd18

Please sign in to comment.