Skip to content

Commit

Permalink
moved reader and list integration to own bundles
Browse files Browse the repository at this point in the history
  • Loading branch information
koertho committed Sep 20, 2018
1 parent d67e037 commit dd8265e
Show file tree
Hide file tree
Showing 17 changed files with 37 additions and 233 deletions.
14 changes: 7 additions & 7 deletions README.md
Original file line number Diff line number Diff line change
@@ -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
Original file line number Diff line number Diff line change
@@ -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.

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

This file was deleted.

7 changes: 4 additions & 3 deletions src/Configuration/ConfigFactory.php
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,10 @@

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

/**
Expand All @@ -38,11 +39,11 @@ 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:
case static::CONTEXT_HTML:
default:
return new YoutubeConfig($this->framework, $config);
}
Expand Down
12 changes: 0 additions & 12 deletions src/ContaoManager/Plugin.php
Original file line number Diff line number Diff line change
Expand Up @@ -46,18 +46,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.

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

This file was deleted.

10 changes: 0 additions & 10 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
Original file line number Diff line number Diff line change
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
Original file line number Diff line number Diff line change
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
Original file line number Diff line number Diff line change
Expand Up @@ -143,7 +143,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 dd8265e

Please sign in to comment.