Skip to content
This repository has been archived by the owner on Feb 26, 2023. It is now read-only.

Commit

Permalink
Added required configuration for facebook service
Browse files Browse the repository at this point in the history
  • Loading branch information
core23 committed Feb 25, 2017
1 parent 965a852 commit 3ec0d82
Show file tree
Hide file tree
Showing 3 changed files with 24 additions and 1 deletion.
10 changes: 10 additions & 0 deletions DependencyInjection/Configuration.php
Expand Up @@ -38,6 +38,16 @@ public function getConfigTreeBuilder()
->end()
->end()
->end()
->arrayNode('services')
->children()
->arrayNode('facebook')
->children()
->scalarNode('app_id')->end()
->scalarNode('secret')->end()
->end()
->end()
->end()
->end()
;

return $treeBuilder;
Expand Down
10 changes: 9 additions & 1 deletion DependencyInjection/Core23ShariffExtension.php
Expand Up @@ -28,6 +28,14 @@ public function load(array $configs, ContainerBuilder $container)
$loader->load('block.xml');
$loader->load('services.xml');

$container->setParameter('core23_shariff.options', $config['options']);
$options = $config['options'];

if (empty($config['services']['facebook']['app_id']) || empty($config['services']['facebook']['secret'])) {
$options['services'] = array_diff($options['services'], array('Facebook'));
} else {
$options['Facebook'] = $config['services']['facebook'];
}

$container->setParameter('core23_shariff.options', $options);
}
}
5 changes: 5 additions & 0 deletions README.md
Expand Up @@ -71,6 +71,11 @@ core23_shariff:
options:
domains: [ ] # Allow specific domains for shariff
services: [ 'GooglePlus', 'Facebook', 'LinkedIn', 'Reddit', 'StumbleUpon', 'Flattr', 'Pinterest', 'Xing', 'AddThis' ]
services:
# Optional configuration when using facebook service
facebook:
app_id: 1234567890
secret: GENERATEDSECRET
```

See [shariff-php] for a list of all available services.
Expand Down

0 comments on commit 3ec0d82

Please sign in to comment.