| author | ymh <ymh.work@gmail.com> |
| Fri, 26 Sep 2014 10:04:40 +0200 | |
| changeset 136 | f209fcb0df6c |
| parent 112 | 14653baf4f6b |
| permissions | -rwxr-xr-x |
|
1
06a22ff5d58d
first commit forminimal bundle structure
ymh <ymh.work@gmail.com>
parents:
diff
changeset
|
1 |
<?php |
|
74
901463f9b11c
add headers for public repository release
ymh <ymh.work@gmail.com>
parents:
63
diff
changeset
|
2 |
/* |
|
901463f9b11c
add headers for public repository release
ymh <ymh.work@gmail.com>
parents:
63
diff
changeset
|
3 |
* This file is part of the WikiTagBundle package. |
|
901463f9b11c
add headers for public repository release
ymh <ymh.work@gmail.com>
parents:
63
diff
changeset
|
4 |
* |
|
901463f9b11c
add headers for public repository release
ymh <ymh.work@gmail.com>
parents:
63
diff
changeset
|
5 |
* (c) IRI <http://www.iri.centrepompidou.fr/> |
|
901463f9b11c
add headers for public repository release
ymh <ymh.work@gmail.com>
parents:
63
diff
changeset
|
6 |
* |
|
901463f9b11c
add headers for public repository release
ymh <ymh.work@gmail.com>
parents:
63
diff
changeset
|
7 |
* For the full copyright and license information, please view the LICENSE |
|
901463f9b11c
add headers for public repository release
ymh <ymh.work@gmail.com>
parents:
63
diff
changeset
|
8 |
* file that was distributed with this source code. |
|
901463f9b11c
add headers for public repository release
ymh <ymh.work@gmail.com>
parents:
63
diff
changeset
|
9 |
*/ |
|
1
06a22ff5d58d
first commit forminimal bundle structure
ymh <ymh.work@gmail.com>
parents:
diff
changeset
|
10 |
|
|
06a22ff5d58d
first commit forminimal bundle structure
ymh <ymh.work@gmail.com>
parents:
diff
changeset
|
11 |
namespace IRI\Bundle\WikiTagBundle\DependencyInjection; |
|
06a22ff5d58d
first commit forminimal bundle structure
ymh <ymh.work@gmail.com>
parents:
diff
changeset
|
12 |
|
|
06a22ff5d58d
first commit forminimal bundle structure
ymh <ymh.work@gmail.com>
parents:
diff
changeset
|
13 |
use Symfony\Component\DependencyInjection\ContainerBuilder; |
|
06a22ff5d58d
first commit forminimal bundle structure
ymh <ymh.work@gmail.com>
parents:
diff
changeset
|
14 |
use Symfony\Component\Config\FileLocator; |
|
06a22ff5d58d
first commit forminimal bundle structure
ymh <ymh.work@gmail.com>
parents:
diff
changeset
|
15 |
use Symfony\Component\HttpKernel\DependencyInjection\Extension; |
|
06a22ff5d58d
first commit forminimal bundle structure
ymh <ymh.work@gmail.com>
parents:
diff
changeset
|
16 |
use Symfony\Component\DependencyInjection\Loader; |
|
06a22ff5d58d
first commit forminimal bundle structure
ymh <ymh.work@gmail.com>
parents:
diff
changeset
|
17 |
|
|
06a22ff5d58d
first commit forminimal bundle structure
ymh <ymh.work@gmail.com>
parents:
diff
changeset
|
18 |
/** |
|
06a22ff5d58d
first commit forminimal bundle structure
ymh <ymh.work@gmail.com>
parents:
diff
changeset
|
19 |
* This is the class that loads and manages your bundle configuration |
|
06a22ff5d58d
first commit forminimal bundle structure
ymh <ymh.work@gmail.com>
parents:
diff
changeset
|
20 |
* |
|
06a22ff5d58d
first commit forminimal bundle structure
ymh <ymh.work@gmail.com>
parents:
diff
changeset
|
21 |
* To learn more see {@link http://symfony.com/doc/current/cookbook/bundles/extension.html} |
|
06a22ff5d58d
first commit forminimal bundle structure
ymh <ymh.work@gmail.com>
parents:
diff
changeset
|
22 |
*/ |
|
06a22ff5d58d
first commit forminimal bundle structure
ymh <ymh.work@gmail.com>
parents:
diff
changeset
|
23 |
class WikiTagExtension extends Extension |
|
06a22ff5d58d
first commit forminimal bundle structure
ymh <ymh.work@gmail.com>
parents:
diff
changeset
|
24 |
{ |
|
06a22ff5d58d
first commit forminimal bundle structure
ymh <ymh.work@gmail.com>
parents:
diff
changeset
|
25 |
/** |
|
06a22ff5d58d
first commit forminimal bundle structure
ymh <ymh.work@gmail.com>
parents:
diff
changeset
|
26 |
* {@inheritDoc} |
|
06a22ff5d58d
first commit forminimal bundle structure
ymh <ymh.work@gmail.com>
parents:
diff
changeset
|
27 |
*/ |
|
06a22ff5d58d
first commit forminimal bundle structure
ymh <ymh.work@gmail.com>
parents:
diff
changeset
|
28 |
public function load(array $configs, ContainerBuilder $container) |
|
06a22ff5d58d
first commit forminimal bundle structure
ymh <ymh.work@gmail.com>
parents:
diff
changeset
|
29 |
{ |
|
06a22ff5d58d
first commit forminimal bundle structure
ymh <ymh.work@gmail.com>
parents:
diff
changeset
|
30 |
$configuration = new Configuration(); |
|
06a22ff5d58d
first commit forminimal bundle structure
ymh <ymh.work@gmail.com>
parents:
diff
changeset
|
31 |
$config = $this->processConfiguration($configuration, $configs); |
|
06a22ff5d58d
first commit forminimal bundle structure
ymh <ymh.work@gmail.com>
parents:
diff
changeset
|
32 |
|
|
06a22ff5d58d
first commit forminimal bundle structure
ymh <ymh.work@gmail.com>
parents:
diff
changeset
|
33 |
$loader = new Loader\YamlFileLoader($container, new FileLocator(__DIR__.'/../Resources/config')); |
|
06a22ff5d58d
first commit forminimal bundle structure
ymh <ymh.work@gmail.com>
parents:
diff
changeset
|
34 |
$loader->load('services.yml'); |
|
17
81962874e172
First implementation of dynamic fields
ymh <ymh.work@gmail.com>
parents:
1
diff
changeset
|
35 |
|
|
81962874e172
First implementation of dynamic fields
ymh <ymh.work@gmail.com>
parents:
1
diff
changeset
|
36 |
if(isset($config['document_class'])) |
|
81962874e172
First implementation of dynamic fields
ymh <ymh.work@gmail.com>
parents:
1
diff
changeset
|
37 |
{ |
|
81962874e172
First implementation of dynamic fields
ymh <ymh.work@gmail.com>
parents:
1
diff
changeset
|
38 |
$container->setParameter("wiki_tag.document_class", $config['document_class']); |
|
81962874e172
First implementation of dynamic fields
ymh <ymh.work@gmail.com>
parents:
1
diff
changeset
|
39 |
} |
| 63 | 40 |
|
41 |
if(isset($config['ignore_wikipedia_error'])) |
|
42 |
{ |
|
43 |
$container->setParameter("wiki_tag.ignore_wikipedia_error", $config['ignore_wikipedia_error']); |
|
44 |
} |
|
45 |
||
|
17
81962874e172
First implementation of dynamic fields
ymh <ymh.work@gmail.com>
parents:
1
diff
changeset
|
46 |
|
|
81962874e172
First implementation of dynamic fields
ymh <ymh.work@gmail.com>
parents:
1
diff
changeset
|
47 |
if(isset($config['document_id_column'])) |
|
81962874e172
First implementation of dynamic fields
ymh <ymh.work@gmail.com>
parents:
1
diff
changeset
|
48 |
{ |
|
81962874e172
First implementation of dynamic fields
ymh <ymh.work@gmail.com>
parents:
1
diff
changeset
|
49 |
$document_id = $config['document_id_column']; |
|
81962874e172
First implementation of dynamic fields
ymh <ymh.work@gmail.com>
parents:
1
diff
changeset
|
50 |
} |
|
81962874e172
First implementation of dynamic fields
ymh <ymh.work@gmail.com>
parents:
1
diff
changeset
|
51 |
|
|
81962874e172
First implementation of dynamic fields
ymh <ymh.work@gmail.com>
parents:
1
diff
changeset
|
52 |
if(!isset($document_id) || is_null($document_id) || strlen($document_id) == 0) { |
|
81962874e172
First implementation of dynamic fields
ymh <ymh.work@gmail.com>
parents:
1
diff
changeset
|
53 |
$document_id = "id"; |
|
81962874e172
First implementation of dynamic fields
ymh <ymh.work@gmail.com>
parents:
1
diff
changeset
|
54 |
} |
|
81962874e172
First implementation of dynamic fields
ymh <ymh.work@gmail.com>
parents:
1
diff
changeset
|
55 |
$container->setParameter("wiki_tag.document_id_column", $document_id); |
|
81962874e172
First implementation of dynamic fields
ymh <ymh.work@gmail.com>
parents:
1
diff
changeset
|
56 |
|
|
23
b435f8055cb4
improve dynamic docs. create and lad class dynamically
ymh <ymh.work@gmail.com>
parents:
21
diff
changeset
|
57 |
$fields = $config['fields']; |
|
b435f8055cb4
improve dynamic docs. create and lad class dynamically
ymh <ymh.work@gmail.com>
parents:
21
diff
changeset
|
58 |
$container->setParameter("wiki_tag.fields", $fields); |
|
b435f8055cb4
improve dynamic docs. create and lad class dynamically
ymh <ymh.work@gmail.com>
parents:
21
diff
changeset
|
59 |
$fields['tagsStr'] = array("type"=>"text"); |
|
b435f8055cb4
improve dynamic docs. create and lad class dynamically
ymh <ymh.work@gmail.com>
parents:
21
diff
changeset
|
60 |
$container->setParameter("wiki_tag.fields_all", $fields); |
|
112
14653baf4f6b
first change for wikipedia and dbpedia lang configuration
cavaliet
parents:
77
diff
changeset
|
61 |
$container->setParameter("wiki_tag.url_templates", $config['url_templates']); |
| 21 | 62 |
$container->setParameter("wiki_tag.route_for_documents_by_tag", $config['route_for_documents_by_tag']); |
|
33
6c87166b819c
First step to add context search to a page. Works fine but needs to be improved with several list of selectors.
cavaliet
parents:
23
diff
changeset
|
63 |
$container->setParameter("wiki_tag.reactive_selectors", $config['reactive_selectors']); |
| 46 | 64 |
$container->setParameter("wiki_tag.document_list_profile", $config['document_list_profile']); |
|
76
bb7808e180c3
Add configuration to enable curl request with proxy or any other CURLOPT
cavaliet
parents:
63
diff
changeset
|
65 |
$container->setParameter("wiki_tag.curl_options", $config['curl_options']); |
|
1
06a22ff5d58d
first commit forminimal bundle structure
ymh <ymh.work@gmail.com>
parents:
diff
changeset
|
66 |
} |
|
06a22ff5d58d
first commit forminimal bundle structure
ymh <ymh.work@gmail.com>
parents:
diff
changeset
|
67 |
} |