From 7973773b35934bc1b079f821c9280c4c0b0c9ea7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Petar=20=C5=A0panja?= Date: Fri, 9 Oct 2015 11:29:22 +0200 Subject: [PATCH] EZP-24925: adapt implementation post Git history rewrite --- .gitignore | 3 + .php_cs | 29 + .travis.yml | 27 + LICENSE | 343 +++++++++++ README.md | 1 + bundle/Converter/Html5.php | 4 +- .../Compiler/XmlTextConverterPass.php | 4 +- .../Parser/FieldType/XmlText.php | 4 +- ...emsEzPlatformXmlTextFieldTypeExtension.php | 70 +++ bundle/EzPublishCoreBundle.php | 133 ---- ...ystemsEzPlatformXmlTextFieldTypeBundle.php | 33 + bundle/Resources/config/default_settings.yml | 261 +------- bundle/Resources/config/ezpublish.yml | 6 + .../Resources/config/fieldtype_services.yml | 254 +------- bundle/Resources/config/services.yml | 398 ------------ bundle/Resources/config/templating.yml | 160 +---- .../Resources/views/content_fields.html.twig | 465 -------------- .../views/fielddefinition_settings.html.twig | 351 ----------- .../Twig/Extension/XmlTextExtension.php | 6 +- composer.json | 36 ++ lib/FieldType/XmlText/Converter.php | 2 +- .../XmlText/Converter/EmbedLinking.php | 2 +- .../XmlText/Converter/EmbedToHtml5.php | 2 +- lib/FieldType/XmlText/Converter/Expanding.php | 2 +- .../XmlText/Converter/EzLinkToHtml5.php | 2 +- lib/FieldType/XmlText/Converter/Html5.php | 2 +- lib/FieldType/XmlText/Input.php | 2 +- lib/FieldType/XmlText/Input/EzXml.php | 2 +- lib/FieldType/XmlText/SearchField.php | 2 +- lib/FieldType/XmlText/Type.php | 2 +- lib/FieldType/XmlText/Value.php | 2 +- lib/FieldType/XmlText/XmlTextStorage.php | 2 +- .../XmlText/XmlTextStorage/Gateway.php | 2 +- .../XmlTextStorage/Gateway/LegacyStorage.php | 2 +- .../FieldValue/Converter/XmlTextConverter.php | 2 +- .../FieldTypeProcessor/XmlTextProcessor.php | 2 +- lib/settings/fieldtype_external_storages.yml | 71 --- lib/settings/fieldtypes.yml | 567 ------------------ lib/settings/indexable_fieldtypes.yml | 149 ----- .../legacy/external_storage_gateways.yml | 67 --- .../legacy/field_value_converters.yml | 253 -------- phpunit-integration-legacy-solr.xml | 28 + phpunit-integration-legacy.xml | 27 + phpunit.xml | 26 + tests/bootstrap.php | 25 + .../Compiler/XmlTextConverterPassTest.php | 6 +- .../Parser/FieldType/XmlTextTest.php | 21 +- .../Fixtures/ezpublish_minimal.yml | 29 + .../FieldType/Converter/EmbedLinkingTest.php | 4 +- .../FieldType/Converter/EmbedToHtml5Test.php | 4 +- .../lib/FieldType/Converter/ExpandingTest.php | 4 +- .../FieldType/Converter/EzLinkToHtml5Test.php | 4 +- tests/lib/FieldType/Converter/Html5Test.php | 6 +- .../FieldType/Gateway/LegacyStorageTest.php | 4 +- tests/lib/FieldType/Input/EzXmlTest.php | 4 +- tests/lib/FieldType/XmlTextTest.php | 4 +- .../FieldValue/Converter/XmlTextTest.php | 4 +- .../XmlTextProcessorTest.php | 4 +- tests/lib/SetupFactory/LegacySetupFactory.php | 37 ++ .../SetupFactory/LegacySolrSetupFactory.php | 37 ++ tests/lib/XmlTextAPIIntegrationTest.php | 37 +- tests/lib/XmlTextSPIIntegrationTest.php | 7 +- 62 files changed, 847 insertions(+), 3202 deletions(-) create mode 100644 .gitignore create mode 100644 .php_cs create mode 100644 .travis.yml create mode 100644 LICENSE create mode 100644 README.md create mode 100644 bundle/DependencyInjection/EzSystemsEzPlatformXmlTextFieldTypeExtension.php delete mode 100644 bundle/EzPublishCoreBundle.php create mode 100644 bundle/EzSystemsEzPlatformXmlTextFieldTypeBundle.php create mode 100644 bundle/Resources/config/ezpublish.yml create mode 100644 composer.json create mode 100644 phpunit-integration-legacy-solr.xml create mode 100644 phpunit-integration-legacy.xml create mode 100644 phpunit.xml create mode 100644 tests/bootstrap.php create mode 100644 tests/bundle/DependencyInjection/Fixtures/ezpublish_minimal.yml create mode 100644 tests/lib/SetupFactory/LegacySetupFactory.php create mode 100644 tests/lib/SetupFactory/LegacySolrSetupFactory.php diff --git a/.gitignore b/.gitignore new file mode 100644 index 00000000..34526486 --- /dev/null +++ b/.gitignore @@ -0,0 +1,3 @@ +/vendor/ +composer.lock +.php_cs.cache diff --git a/.php_cs b/.php_cs new file mode 100644 index 00000000..d96de183 --- /dev/null +++ b/.php_cs @@ -0,0 +1,29 @@ +setUsingLinter(false) + ->setUsingCache(true) + ->level(Symfony\CS\FixerInterface::SYMFONY_LEVEL) + ->fixers([ + 'concat_with_spaces', + '-concat_without_spaces', + '-empty_return', + '-phpdoc_params', + '-phpdoc_separation', + '-phpdoc_to_comment', + '-spaces_cast', + '-blankline_after_open_tag', + '-single_blank_line_before_namespace', + // psr0 has weird issues with our PSR-4 layout, so deactivating it. + '-psr0', + ]) + ->finder( + Symfony\CS\Finder\DefaultFinder::create() + ->in(__DIR__) + ->notPath('phpunit.xml') + ->exclude([ + 'vendor', + ]) + ->files()->name('*.php') + ) +; diff --git a/.travis.yml b/.travis.yml new file mode 100644 index 00000000..76292e28 --- /dev/null +++ b/.travis.yml @@ -0,0 +1,27 @@ +language: php + +matrix: + include: + - php: 5.4 + env: TEST_CONFIG="phpunit.xml" + - php: 5.5 + env: TEST_CONFIG="phpunit-integration-legacy.xml" + - php: 5.6 + env: TEST_CONFIG="phpunit-integration-legacy-solr.xml" SOLR_VERSION="4.10.4" CORES_SETUP="single" SOLR_CONFS="vendor/ezsystems/ezplatform-solr-search-engine/lib/Resources/config/solr/schema.xml vendor/ezsystems/ezplatform-solr-search-engine/lib/Resources/config/solr/custom-fields-types.xml vendor/ezsystems/ezplatform-solr-search-engine/lib/Resources/config/solr/language-fieldtypes.xml" + +# test only master (+ Pull requests) +branches: + only: + - master + +before_script: +# - composer selfupdate + - curl -sS https://getcomposer.org/installer | php + - php -d memory_limit=-1 composer.phar install --prefer-dist + - if [ "$SOLR_VERSION" != "" ] ; then ./vendor/ezsystems/ezplatform-solr-search-engine/bin/.travis/init_solr.sh ; fi + +script: + - php vendor/bin/phpunit --bootstrap tests/bootstrap.php -c $TEST_CONFIG + +notifications: + email: false diff --git a/LICENSE b/LICENSE new file mode 100644 index 00000000..89beea2f --- /dev/null +++ b/LICENSE @@ -0,0 +1,343 @@ +Copyright (C) 1999-2015 eZ Systems AS. All rights reserved. +This source code is provided under the following license: + + + GNU GENERAL PUBLIC LICENSE + Version 2, June 1991 + + Copyright (C) 1989, 1991 Free Software Foundation, Inc., + 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + Everyone is permitted to copy and distribute verbatim copies + of this license document, but changing it is not allowed. + + Preamble + + The licenses for most software are designed to take away your +freedom to share and change it. By contrast, the GNU General Public +License is intended to guarantee your freedom to share and change free +software--to make sure the software is free for all its users. This +General Public License applies to most of the Free Software +Foundation's software and to any other program whose authors commit to +using it. (Some other Free Software Foundation software is covered by +the GNU Lesser General Public License instead.) You can apply it to +your programs, too. + + When we speak of free software, we are referring to freedom, not +price. Our General Public Licenses are designed to make sure that you +have the freedom to distribute copies of free software (and charge for +this service if you wish), that you receive source code or can get it +if you want it, that you can change the software or use pieces of it +in new free programs; and that you know you can do these things. + + To protect your rights, we need to make restrictions that forbid +anyone to deny you these rights or to ask you to surrender the rights. +These restrictions translate to certain responsibilities for you if you +distribute copies of the software, or if you modify it. + + For example, if you distribute copies of such a program, whether +gratis or for a fee, you must give the recipients all the rights that +you have. You must make sure that they, too, receive or can get the +source code. And you must show them these terms so they know their +rights. + + We protect your rights with two steps: (1) copyright the software, and +(2) offer you this license which gives you legal permission to copy, +distribute and/or modify the software. + + Also, for each author's protection and ours, we want to make certain +that everyone understands that there is no warranty for this free +software. If the software is modified by someone else and passed on, we +want its recipients to know that what they have is not the original, so +that any problems introduced by others will not reflect on the original +authors' reputations. + + Finally, any free program is threatened constantly by software +patents. We wish to avoid the danger that redistributors of a free +program will individually obtain patent licenses, in effect making the +program proprietary. To prevent this, we have made it clear that any +patent must be licensed for everyone's free use or not licensed at all. + + The precise terms and conditions for copying, distribution and +modification follow. + + GNU GENERAL PUBLIC LICENSE + TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION + + 0. This License applies to any program or other work which contains +a notice placed by the copyright holder saying it may be distributed +under the terms of this General Public License. The "Program", below, +refers to any such program or work, and a "work based on the Program" +means either the Program or any derivative work under copyright law: +that is to say, a work containing the Program or a portion of it, +either verbatim or with modifications and/or translated into another +language. (Hereinafter, translation is included without limitation in +the term "modification".) Each licensee is addressed as "you". + +Activities other than copying, distribution and modification are not +covered by this License; they are outside its scope. The act of +running the Program is not restricted, and the output from the Program +is covered only if its contents constitute a work based on the +Program (independent of having been made by running the Program). +Whether that is true depends on what the Program does. + + 1. You may copy and distribute verbatim copies of the Program's +source code as you receive it, in any medium, provided that you +conspicuously and appropriately publish on each copy an appropriate +copyright notice and disclaimer of warranty; keep intact all the +notices that refer to this License and to the absence of any warranty; +and give any other recipients of the Program a copy of this License +along with the Program. + +You may charge a fee for the physical act of transferring a copy, and +you may at your option offer warranty protection in exchange for a fee. + + 2. You may modify your copy or copies of the Program or any portion +of it, thus forming a work based on the Program, and copy and +distribute such modifications or work under the terms of Section 1 +above, provided that you also meet all of these conditions: + + a) You must cause the modified files to carry prominent notices + stating that you changed the files and the date of any change. + + b) You must cause any work that you distribute or publish, that in + whole or in part contains or is derived from the Program or any + part thereof, to be licensed as a whole at no charge to all third + parties under the terms of this License. + + c) If the modified program normally reads commands interactively + when run, you must cause it, when started running for such + interactive use in the most ordinary way, to print or display an + announcement including an appropriate copyright notice and a + notice that there is no warranty (or else, saying that you provide + a warranty) and that users may redistribute the program under + these conditions, and telling the user how to view a copy of this + License. (Exception: if the Program itself is interactive but + does not normally print such an announcement, your work based on + the Program is not required to print an announcement.) + +These requirements apply to the modified work as a whole. If +identifiable sections of that work are not derived from the Program, +and can be reasonably considered independent and separate works in +themselves, then this License, and its terms, do not apply to those +sections when you distribute them as separate works. But when you +distribute the same sections as part of a whole which is a work based +on the Program, the distribution of the whole must be on the terms of +this License, whose permissions for other licensees extend to the +entire whole, and thus to each and every part regardless of who wrote it. + +Thus, it is not the intent of this section to claim rights or contest +your rights to work written entirely by you; rather, the intent is to +exercise the right to control the distribution of derivative or +collective works based on the Program. + +In addition, mere aggregation of another work not based on the Program +with the Program (or with a work based on the Program) on a volume of +a storage or distribution medium does not bring the other work under +the scope of this License. + + 3. You may copy and distribute the Program (or a work based on it, +under Section 2) in object code or executable form under the terms of +Sections 1 and 2 above provided that you also do one of the following: + + a) Accompany it with the complete corresponding machine-readable + source code, which must be distributed under the terms of Sections + 1 and 2 above on a medium customarily used for software interchange; or, + + b) Accompany it with a written offer, valid for at least three + years, to give any third party, for a charge no more than your + cost of physically performing source distribution, a complete + machine-readable copy of the corresponding source code, to be + distributed under the terms of Sections 1 and 2 above on a medium + customarily used for software interchange; or, + + c) Accompany it with the information you received as to the offer + to distribute corresponding source code. (This alternative is + allowed only for noncommercial distribution and only if you + received the program in object code or executable form with such + an offer, in accord with Subsection b above.) + +The source code for a work means the preferred form of the work for +making modifications to it. For an executable work, complete source +code means all the source code for all modules it contains, plus any +associated interface definition files, plus the scripts used to +control compilation and installation of the executable. However, as a +special exception, the source code distributed need not include +anything that is normally distributed (in either source or binary +form) with the major components (compiler, kernel, and so on) of the +operating system on which the executable runs, unless that component +itself accompanies the executable. + +If distribution of executable or object code is made by offering +access to copy from a designated place, then offering equivalent +access to copy the source code from the same place counts as +distribution of the source code, even though third parties are not +compelled to copy the source along with the object code. + + 4. You may not copy, modify, sublicense, or distribute the Program +except as expressly provided under this License. Any attempt +otherwise to copy, modify, sublicense or distribute the Program is +void, and will automatically terminate your rights under this License. +However, parties who have received copies, or rights, from you under +this License will not have their licenses terminated so long as such +parties remain in full compliance. + + 5. You are not required to accept this License, since you have not +signed it. However, nothing else grants you permission to modify or +distribute the Program or its derivative works. These actions are +prohibited by law if you do not accept this License. Therefore, by +modifying or distributing the Program (or any work based on the +Program), you indicate your acceptance of this License to do so, and +all its terms and conditions for copying, distributing or modifying +the Program or works based on it. + + 6. Each time you redistribute the Program (or any work based on the +Program), the recipient automatically receives a license from the +original licensor to copy, distribute or modify the Program subject to +these terms and conditions. You may not impose any further +restrictions on the recipients' exercise of the rights granted herein. +You are not responsible for enforcing compliance by third parties to +this License. + + 7. If, as a consequence of a court judgment or allegation of patent +infringement or for any other reason (not limited to patent issues), +conditions are imposed on you (whether by court order, agreement or +otherwise) that contradict the conditions of this License, they do not +excuse you from the conditions of this License. If you cannot +distribute so as to satisfy simultaneously your obligations under this +License and any other pertinent obligations, then as a consequence you +may not distribute the Program at all. For example, if a patent +license would not permit royalty-free redistribution of the Program by +all those who receive copies directly or indirectly through you, then +the only way you could satisfy both it and this License would be to +refrain entirely from distribution of the Program. + +If any portion of this section is held invalid or unenforceable under +any particular circumstance, the balance of the section is intended to +apply and the section as a whole is intended to apply in other +circumstances. + +It is not the purpose of this section to induce you to infringe any +patents or other property right claims or to contest validity of any +such claims; this section has the sole purpose of protecting the +integrity of the free software distribution system, which is +implemented by public license practices. Many people have made +generous contributions to the wide range of software distributed +through that system in reliance on consistent application of that +system; it is up to the author/donor to decide if he or she is willing +to distribute software through any other system and a licensee cannot +impose that choice. + +This section is intended to make thoroughly clear what is believed to +be a consequence of the rest of this License. + + 8. If the distribution and/or use of the Program is restricted in +certain countries either by patents or by copyrighted interfaces, the +original copyright holder who places the Program under this License +may add an explicit geographical distribution limitation excluding +those countries, so that distribution is permitted only in or among +countries not thus excluded. In such case, this License incorporates +the limitation as if written in the body of this License. + + 9. The Free Software Foundation may publish revised and/or new versions +of the General Public License from time to time. Such new versions will +be similar in spirit to the present version, but may differ in detail to +address new problems or concerns. + +Each version is given a distinguishing version number. If the Program +specifies a version number of this License which applies to it and "any +later version", you have the option of following the terms and conditions +either of that version or of any later version published by the Free +Software Foundation. If the Program does not specify a version number of +this License, you may choose any version ever published by the Free Software +Foundation. + + 10. If you wish to incorporate parts of the Program into other free +programs whose distribution conditions are different, write to the author +to ask for permission. For software which is copyrighted by the Free +Software Foundation, write to the Free Software Foundation; we sometimes +make exceptions for this. Our decision will be guided by the two goals +of preserving the free status of all derivatives of our free software and +of promoting the sharing and reuse of software generally. + + NO WARRANTY + + 11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY +FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN +OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES +PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED +OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF +MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS +TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE +PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING, +REPAIR OR CORRECTION. + + 12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING +WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR +REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, +INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING +OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED +TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY +YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER +PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE +POSSIBILITY OF SUCH DAMAGES. + + END OF TERMS AND CONDITIONS + + How to Apply These Terms to Your New Programs + + If you develop a new program, and you want it to be of the greatest +possible use to the public, the best way to achieve this is to make it +free software which everyone can redistribute and change under these terms. + + To do so, attach the following notices to the program. It is safest +to attach them to the start of each source file to most effectively +convey the exclusion of warranty; and each file should have at least +the "copyright" line and a pointer to where the full notice is found. + + + Copyright (C) + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License along + with this program; if not, write to the Free Software Foundation, Inc., + 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + +Also add information on how to contact you by electronic and paper mail. + +If the program is interactive, make it output a short notice like this +when it starts in an interactive mode: + + Gnomovision version 69, Copyright (C) year name of author + Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'. + This is free software, and you are welcome to redistribute it + under certain conditions; type `show c' for details. + +The hypothetical commands `show w' and `show c' should show the appropriate +parts of the General Public License. Of course, the commands you use may +be called something other than `show w' and `show c'; they could even be +mouse-clicks or menu items--whatever suits your program. + +You should also get your employer (if you work as a programmer) or your +school, if any, to sign a "copyright disclaimer" for the program, if +necessary. Here is a sample; alter the names: + + Yoyodyne, Inc., hereby disclaims all copyright interest in the program + `Gnomovision' (which makes passes at compilers) written by James Hacker. + + , 1 April 1989 + Ty Coon, President of Vice + +This General Public License does not permit incorporating your program into +proprietary programs. If your program is a subroutine library, you may +consider it more useful to permit linking proprietary applications with the +library. If this is what you want to do, use the GNU Lesser General +Public License instead of this License. diff --git a/README.md b/README.md new file mode 100644 index 00000000..d7653514 --- /dev/null +++ b/README.md @@ -0,0 +1 @@ +# XmlText field type for eZ Platform diff --git a/bundle/Converter/Html5.php b/bundle/Converter/Html5.php index ea35c5fa..90dfb618 100644 --- a/bundle/Converter/Html5.php +++ b/bundle/Converter/Html5.php @@ -1,14 +1,14 @@ load('fieldtype_external_storages.yml'); + $loader->load('fieldtypes.yml'); + $loader->load('indexable_fieldtypes.yml'); + $loader->load('storage_engines/legacy/external_storage_gateways.yml'); + $loader->load('storage_engines/legacy/field_value_converters.yml'); + + // Load bundle configuration + $loader = new Loader\YamlFileLoader( + $container, + new FileLocator(__DIR__ . '/../Resources/config') + ); + $loader->load('services.yml'); + $loader->load('fieldtype_services.yml'); + $loader->load('templating.yml'); + } + + /** + * Allow an extension to prepend the extension configurations. + * + * @param \Symfony\Component\DependencyInjection\ContainerBuilder $container + */ + public function prepend(ContainerBuilder $container) + { + // Field type's Content field and ContentType field definition templates + $configFile = __DIR__ . '/../Resources/config/ezpublish.yml'; + $config = Yaml::parse(file_get_contents($configFile)); + $container->prependExtensionConfig('ezpublish', $config); + $container->addResource(new FileResource($configFile)); + } +} diff --git a/bundle/EzPublishCoreBundle.php b/bundle/EzPublishCoreBundle.php deleted file mode 100644 index ac16d18e..00000000 --- a/bundle/EzPublishCoreBundle.php +++ /dev/null @@ -1,133 +0,0 @@ -addCompilerPass(new FieldTypeCollectionPass(), PassConfig::TYPE_OPTIMIZE); - $container->addCompilerPass(new FieldTypeParameterProviderRegistryPass()); - $container->addCompilerPass(new ChainRoutingPass()); - $container->addCompilerPass(new ChainConfigResolverPass()); - $container->addCompilerPass(new RegisterLimitationTypePass()); - $container->addCompilerPass(new RegisterStorageEnginePass()); - $container->addCompilerPass(new RegisterSearchEnginePass()); - $container->addCompilerPass(new LegacyStorageEnginePass()); - $container->addCompilerPass(new LocalePass()); - $container->addCompilerPass(new ContentViewPass()); - $container->addCompilerPass(new LocationViewPass()); - $container->addCompilerPass(new BlockViewPass()); - $container->addCompilerPass(new SignalSlotPass()); - $container->addCompilerPass(new IdentityDefinerPass()); - $container->addCompilerPass(new XmlTextConverterPass()); - $container->addCompilerPass(new SecurityPass()); - $container->addCompilerPass(new RichTextHtml5ConverterPass()); - $container->addCompilerPass(new FragmentPass()); - $container->addCompilerPass(new StorageConnectionPass()); - $container->addCompilerPass(new ImaginePass()); - $container->addCompilerPass(new HttpCachePass()); - $container->addCompilerPass(new ComplexSettingsPass(new ComplexSettingParser())); - $container->addCompilerPass(new ConfigResolverParameterPass(new DynamicSettingParser())); - $container->addCompilerPass(new AsseticPass()); - $container->addCompilerPass( - new RegisterListenersPass( - 'ezpublish.http_cache.event_dispatcher', - 'ezpublish.http_cache.event_listener', - 'ezpublish.http_cache.event_subscriber' - ), - PassConfig::TYPE_BEFORE_REMOVING - ); - $container->addCompilerPass(new BinaryContentDownloadPass()); - $container->addCompilerPass(new ViewProvidersPass()); - - // Storage passes - $container->addCompilerPass(new ExternalStorageRegistryPass()); - // Legacy Storage passes - $container->addCompilerPass(new FieldValueConverterRegistryPass()); - $container->addCompilerPass(new RoleLimitationConverterPass()); - $container->addCompilerPass(new QueryTypePass()); - - $securityExtension = $container->getExtension('security'); - $securityExtension->addSecurityListenerFactory(new HttpBasicFactory()); - } - - public function getContainerExtension() - { - if (!isset($this->extension)) { - $this->extension = new EzPublishCoreExtension( - array( - new ConfigParser\LocationView(), - new ConfigParser\ContentView(), - new ConfigParser\BlockView(), - new ConfigParser\Common(), - new ConfigParser\Content(), - new ConfigParser\FieldType\RichText(), - new ConfigParser\FieldType\XmlText(), - new ConfigParser\FieldTemplates(), - new ConfigParser\FieldEditTemplates(), - new ConfigParser\FieldDefinitionSettingsTemplates(), - new ConfigParser\FieldDefinitionEditTemplates(), - new ConfigParser\Image(), - new ConfigParser\Page(), - new ConfigParser\Languages(), - new ConfigParser\IO(new ComplexSettingParser()), - ) - ); - - $this->extension->addPolicyProvider(new RepositoryPolicyProvider()); - } - - return $this->extension; - } -} diff --git a/bundle/EzSystemsEzPlatformXmlTextFieldTypeBundle.php b/bundle/EzSystemsEzPlatformXmlTextFieldTypeBundle.php new file mode 100644 index 00000000..7281b433 --- /dev/null +++ b/bundle/EzSystemsEzPlatformXmlTextFieldTypeBundle.php @@ -0,0 +1,33 @@ +addCompilerPass(new XmlTextConverterPass()); + + /** + * @var \eZ\Bundle\EzPublishCoreBundle\DependencyInjection\EzPublishCoreExtension $eZExtension + */ + $eZExtension = $container->getExtension('ezpublish'); + $eZExtension->addConfigParser(new ConfigParser\FieldType\XmlText()); + $eZExtension->addDefaultSettings(__DIR__ . '/Resources/config', ['default_settings.yml']); + } +} diff --git a/bundle/Resources/config/default_settings.yml b/bundle/Resources/config/default_settings.yml index a7faad0a..cbd62c26 100644 --- a/bundle/Resources/config/default_settings.yml +++ b/bundle/Resources/config/default_settings.yml @@ -1,267 +1,10 @@ parameters: - # Kernel related params - webroot_dir: %kernel.root_dir%/../web - - ### - # ezsettings namespace, default scope - ### - - # Content/Location view - ezsettings.default.location_view: {} - ezsettings.default.content_view: {} - ezsettings.default.block_view: {} - - # Common settings - ezpublish.repositories: {} - ezsettings.default.repository: ~ - ezpublish.session_name.default: "eZSESSID{siteaccess_hash}" - ezsettings.default.session_name: %ezpublish.session_name.default% # Using "{siteaccess_hash}" in session name makes it unique per siteaccess - ezsettings.default.session: { name: %ezpublish.session_name.default% } # Session options that will override options from framework - ezsettings.default.url_alias_router: true # Use UrlAliasRouter by default - ezsettings.default.index_page: ~ # The page to show when accessing IndexPage (/) - ezsettings.default.default_page: ~ # The default page to show, e.g. after user login this will be used for default redirection - ezsettings.default.languages: [] - ezsettings.default.translation_siteaccesses: [] - ezsettings.default.related_siteaccesses: [] - ezsettings.default.cache_pool_name: "default" # The cache pool name to use for a siteaccess / siteaccess-group - ezsettings.default.var_dir: "var" # The root directory where all log files, cache files and other stored files are created - ezsettings.default.storage_dir: "storage" # Where to place new files for storage, it's relative to var directory - ezsettings.default.binary_dir: "original" - ezsettings.default.anonymous_user_id: 10 # The ID of the user to be used for everyone who is not logged in - - # IO - ezsettings.default.io.metadata_handler: "default" - ezsettings.default.io.binarydata_handler: "default" - ezsettings.default.io.url_prefix: "$var_dir$/$storage_dir$" - ezsettings.default.io.legacy_url_prefix: "$var_dir$/$storage_dir$" - ezsettings.default.io.root_dir: "%webroot_dir%/$var_dir$/$storage_dir$" - - # Content settings - ezsettings.default.content.view_cache: true # Whether to use content view cache or not (Etag/Last-Modified based) - ezsettings.default.content.ttl_cache: true # Whether to use TTL Cache for content (i.e. Max-Age response header) - ezsettings.default.content.default_ttl: 60 # Default TTL cache value for content - ezsettings.default.content.tree_root.location_id: 2 # Root locationId for routing and link generation. Useful for multisite apps with one repository. - ezsettings.default.content.tree_root.excluded_uri_prefixes: [] # URI prefixes that are allowed to be outside the content tree - - # FieldType settings # Default XSL stylesheets for XmlText rendering to HTML5. # Built-in stylesheets are treated as custom for the sake of extensibility. ezsettings.default.fieldtypes.ezxml.custom_xsl: - - path: %kernel.root_dir%/../vendor/ezsystems/ezpublish-kernel/eZ/Publish/Core/FieldType/XmlText/Input/Resources/stylesheets/eZXml2Html5_core.xsl + path: %kernel.root_dir%/../vendor/ezsystems/ezplatform-xmltext-fieldtype/lib/FieldType/XmlText/Input/Resources/stylesheets/eZXml2Html5_core.xsl priority: 0 - - path: %kernel.root_dir%/../vendor/ezsystems/ezpublish-kernel/eZ/Publish/Core/FieldType/XmlText/Input/Resources/stylesheets/eZXml2Html5_custom.xsl + path: %kernel.root_dir%/../vendor/ezsystems/ezplatform-xmltext-fieldtype/lib/FieldType/XmlText/Input/Resources/stylesheets/eZXml2Html5_custom.xsl priority: 0 - - # FieldType settings - # Default XSL stylesheets for RichText rendering to HTML5. - # Built-in stylesheets are treated as custom for the sake of extensibility. - ezsettings.default.fieldtypes.ezrichtext.output_custom_xsl: - - - path: %kernel.root_dir%/../vendor/ezsystems/ezpublish-kernel/eZ/Publish/Core/FieldType/RichText/Resources/stylesheets/docbook/xhtml5/output/core.xsl - priority: 0 - - ezsettings.default.fieldtypes.ezrichtext.edit_custom_xsl: - - - path: %kernel.root_dir%/../vendor/ezsystems/ezpublish-kernel/eZ/Publish/Core/FieldType/RichText/Resources/stylesheets/docbook/xhtml5/edit/core.xsl - priority: 0 - - ezsettings.default.fieldtypes.ezrichtext.input_custom_xsl: [] - - # RichText field type template tag settings - # 'default' and 'default_inline' tag identifiers are reserved for fallback - ezsettings.default.fieldtypes.ezrichtext.tags.default: - template: EzPublishCoreBundle:FieldType/RichText/tag:default.html.twig - ezsettings.default.fieldtypes.ezrichtext.tags.default_inline: - template: EzPublishCoreBundle:FieldType/RichText/tag:default_inline.html.twig - - # RichText field type embed settings - ezsettings.default.fieldtypes.ezrichtext.embed.content: - template: EzPublishCoreBundle:FieldType/RichText/embed:content.html.twig - ezsettings.default.fieldtypes.ezrichtext.embed.content_denied: - template: EzPublishCoreBundle:FieldType/RichText/embed:content_denied.html.twig - ezsettings.default.fieldtypes.ezrichtext.embed.content_inline: - template: EzPublishCoreBundle:FieldType/RichText/embed:content_inline.html.twig - ezsettings.default.fieldtypes.ezrichtext.embed.content_inline_denied: - template: EzPublishCoreBundle:FieldType/RichText/embed:content_inline_denied.html.twig - ezsettings.default.fieldtypes.ezrichtext.embed.location: - template: EzPublishCoreBundle:FieldType/RichText/embed:location.html.twig - ezsettings.default.fieldtypes.ezrichtext.embed.location_denied: - template: EzPublishCoreBundle:FieldType/RichText/embed:location_denied.html.twig - ezsettings.default.fieldtypes.ezrichtext.embed.location_inline: - template: EzPublishCoreBundle:FieldType/RichText/embed:location_inline.html.twig - ezsettings.default.fieldtypes.ezrichtext.embed.location_inline_denied: - template: EzPublishCoreBundle:FieldType/RichText/embed:location_inline_denied.html.twig - - # Cache settings - # Server(s) URL(s) that will be used for purging HTTP cache with BAN requests. - ezsettings.default.http_cache.purge_servers: [] - - # Treemenu settings (admin interface) - ezsettings.default.treemenu.http_cache: true # Whether to use HttpCache or not for admin tree menu - ezsettings.default.treemenu.ttl_cache: 86400 # If HttpCache is used, cache time to live in seconds - - # Templates to use while rendering fields - ezsettings.default.field_templates: - - {template: EzPublishCoreBundle::content_fields.html.twig, priority: 0} - - # Templates for Field edition. Follows the same structure than for field_templates - ezsettings.default.field_edit_templates: [] - - # Templates to use while rendering field definition settings - ezsettings.default.fielddefinition_settings_templates: - - {template: EzPublishCoreBundle::fielddefinition_settings.html.twig, priority: 0} - - # Templates for FieldDefinition edition. Follows the same structure than for field_templates - ezsettings.default.fielddefinition_edit_templates: [] - - # Security settings - ezsettings.default.security.login_template: "EzPublishCoreBundle:Security:login.html.twig" - ezsettings.default.security.base_layout: %ezpublish.content_view.viewbase_layout% - - # Image settings - ezsettings.default.image.temporary_dir: imagetmp - ezsettings.default.image.published_images_dir: images - ezsettings.default.image.versioned_images_dir: images-versioned - ezsettings.default.image_variations: - reference: - reference: ~ - filters: - geometry/scaledownonly: [600, 600] - small: - reference: reference - filters: - geometry/scaledownonly: [100, 100] - tiny: - reference: reference - filters: - geometry/scaledownonly: [30, 30] - medium: - reference: reference - filters: - geometry/scaledownonly: [200, 200] - large: - reference: reference - filters: - geometry/scaledownonly: [300, 300] - - # ImageMagick - # TODO: Deprecated. Move this to ezpublish_legacy. - ezpublish.image.imagemagick.enabled: false - ezpublish.image.imagemagick.executable_path: - ezpublish.image.imagemagick.executable: convert - ezsettings.default.imagemagick.pre_parameters: - ezsettings.default.imagemagick.post_parameters: - ezpublish.image.imagemagick.filters: - geometry/scale: "-geometry {1}x{2}" - geometry/scalewidth: "-geometry {1}" - geometry/scaleheight: "-geometry x{1}" - geometry/scaledownonly: "-geometry {1}x{2}>" - geometry/scalewidthdownonly: "-geometry {1}>" - geometry/scaleheightdownonly: "-geometry x{1}>" - geometry/scaleexact: "-geometry {1}x{2}!" - geometry/scalepercent: "-geometry {1}x{2}%" - geometry/crop: "-crop {1}x{2}+{3}+{4}" - filter/noise: "-noise {1}" - filter/swirl: "-swirl {1}" - colorspace/gray: "-colorspace GRAY" - colorspace/transparent: "-colorspace Transparent" - colorspace: "-colorspace {1}" - border: "-border {1}x{2}" - border/color: "-bordercolor rgb({1},{2},{3})" - border/width: "-borderwidth {1}" - flatten: "-flatten" - resize: "-resize {1}" - optimize: "-strip" - - ### - # default ezpage settings - ## - ezpublish.ezpage.enabledLayouts: [] - ezpublish.ezpage.enabledBlocks: [] - ezpublish.ezpage.layouts: - GlobalZoneLayout: - name: Global zone layout - template: globalzonelayout.tpl - 2ZonesLayout1: - name: 2 zones (layout 1) - template: 2zoneslayout1.tpl - 2ZonesLayout2: - name: 2 zones (layout 2) - template: 2zoneslayout2.tpl - 2ZonesLayout3: - name: 2 zones (layout 3) - template: 2zoneslayout3.tpl - 3ZonesLayout1: - name: 3 zones (layout 1) - template: 3zoneslayout1.tpl - 3ZonesLayout2: - name: 3 zones (layout 2) - template: 3zoneslayout2.tpl - CallForActionLayout: - name: Call For Action zone layout - template: callforactionlayout.tpl - - ezpublish.ezpage.blocks: - DemoBlock: - name: Demo Block - Manual2Items: - name: 2 items (Manual) - Manual3Items: - name: 3 items (Manual) - Manual4Items: - name: 4 items (Manual) - Manual5Items: - name: 5 items (Manual) - Dynamic3Items: - name: 3 items (Dynamic) - Gallery: - name: Gallery (Manual) - Video: - name: Video (Manual) - ItemList: - name: Item list - MainStory: - name: Main story (Manual) - Banner: - name: Banner - TagCloud: - name: Tag cloud - Poll: - name: Poll - FlashRecorder: - name: Flash Recorder - FeedReader: - name: Feed reader - Keyword: - name: Keyword - GMap: - name: Google Map - OnlineUsers: - name: Online Users - MultimediaCarousel: - name: Multimedia carousel - Search: - name: Search - Ads: - name: Advertisement - LatestContent: - name: Latest content - TopRated: - name: Top Rated - GMapItems: - name: Google Map Items - - ### - # Internal settings - ### - ezpublish.siteaccess.groups: {} - ezpublish.siteaccess.groups_by_siteaccess: {} - ezpublish.siteaccess.default: ~ - # SiteAccesses relation map. 2 dimensions array. - # First dimension is indexed by repository identifier. - # Second dimension is indexed by root location Id. - ezpublish.siteaccess.relation_map: {} - # SiteAccesses, indexed by language. - ezpublish.siteaccesses_by_language: {} diff --git a/bundle/Resources/config/ezpublish.yml b/bundle/Resources/config/ezpublish.yml new file mode 100644 index 00000000..11f16370 --- /dev/null +++ b/bundle/Resources/config/ezpublish.yml @@ -0,0 +1,6 @@ +system: + default: + field_templates: + - {template: 'EzSystemsEzPlatformXmlTextFieldTypeBundle::content_fields.html.twig', priority: 10} + fielddefinition_settings_templates: + - {template: 'EzSystemsEzPlatformXmlTextFieldTypeBundle::fielddefinition_settings.html.twig', priority: 10} diff --git a/bundle/Resources/config/fieldtype_services.yml b/bundle/Resources/config/fieldtype_services.yml index 4c358c49..dde2494f 100644 --- a/bundle/Resources/config/fieldtype_services.yml +++ b/bundle/Resources/config/fieldtype_services.yml @@ -1,104 +1,13 @@ parameters: - # Parameter provider - ezpublish.fieldType.parameterProviderRegistry.class: eZ\Publish\Core\MVC\Symfony\FieldType\View\ParameterProviderRegistry - ezpublish.fieldType.ezpage.parameterProvider.class: eZ\Publish\Core\MVC\Symfony\FieldType\Page\ParameterProvider - ezpublish.fieldType.locale.parameterProvider.class: eZ\Publish\Core\MVC\Symfony\FieldType\View\ParameterProvider\LocaleParameterProvider - - # Page - ezpublish.fieldType.ezpage.pageService.class: eZ\Bundle\EzPublishCoreBundle\FieldType\Page\PageService - ezpublish.fieldType.ezpage.pageService.factory.class: eZ\Publish\Core\MVC\Symfony\FieldType\Page\PageServiceFactory - ezpublish.fieldType.ezpage.block.class: eZ\Publish\Core\FieldType\Page\Parts\Block - ezpublish.fieldType.ezpage.zone.class: eZ\Publish\Core\FieldType\Page\Parts\Zone - ezpublish.fieldType.ezpage.hashConverter.class: eZ\Publish\Core\FieldType\Page\HashConverter - - # XmlText - ezpublish.fieldType.ezxmltext.converter.html5.class: eZ\Bundle\EzPublishCoreBundle\FieldType\XmlText\Converter\Html5 - ezpublish.fieldType.ezxmltext.converter.html5.resources: %ezpublish.kernel.root_dir%/eZ/Publish/Core/FieldType/XmlText/Input/Resources/stylesheets/eZXml2Html5.xsl + ezpublish.fieldType.ezxmltext.converter.html5.class: EzSystems\EzPlatformXmlTextFieldTypeBundle\Converter\Html5 + ezpublish.fieldType.ezxmltext.converter.html5.resources: %kernel.root_dir%/../vendor/ezsystems/ezplatform-xmltext-fieldtype/lib/FieldType/XmlText/Input/Resources/stylesheets/eZXml2Html5.xsl ezpublish.fieldType.ezxmltext.converter.embedToHtml5.class: eZ\Publish\Core\FieldType\XmlText\Converter\EmbedToHtml5 ezpublish.fieldType.ezxmlText.converter.embedToHtml5.excludedAttributes: [view, node_id, object_id] ezpublish.fieldType.ezxmltext.converter.ezLinkToHtml5.class: eZ\Publish\Core\FieldType\XmlText\Converter\EzLinkToHtml5 ezpublish.fieldType.ezxmltext.converter.expanding.class: eZ\Publish\Core\FieldType\XmlText\Converter\Expanding ezpublish.fieldType.ezxmltext.converter.embedLinking.class: eZ\Publish\Core\FieldType\XmlText\Converter\EmbedLinking - # RichText - ezpublish.fieldType.ezrichtext.converter.xslt.class: eZ\Publish\Core\FieldType\RichText\Converter\Xslt - ezpublish.fieldType.ezrichtext.converter.aggregate.class: eZ\Publish\Core\FieldType\RichText\Converter\Aggregate - ezpublish.fieldType.ezrichtext.converter.output.html5.class: eZ\Bundle\EzPublishCoreBundle\FieldType\RichText\Converter\Html5 - ezpublish.fieldType.ezrichtext.converter.edit.html5.class: eZ\Bundle\EzPublishCoreBundle\FieldType\RichText\Converter\Html5Edit - ezpublish.fieldType.ezrichtext.converter.input.ezxml.normalize.class: eZ\Bundle\EzPublishCoreBundle\FieldType\RichText\Converter\Ezxml\ToRichTextPreNormalize - ezpublish.fieldType.ezrichtext.converter.input.html5.class: eZ\Bundle\EzPublishCoreBundle\FieldType\RichText\Converter\Html5Input - ezpublish.fieldType.ezrichtext.converter.link.class: eZ\Publish\Core\FieldType\RichText\Converter\Link - ezpublish.fieldType.ezrichtext.converter.embed.class: eZ\Publish\Core\FieldType\RichText\Converter\Render\Embed - ezpublish.fieldType.ezrichtext.converter.template.class: eZ\Publish\Core\FieldType\RichText\Converter\Render\Template - ezpublish.fieldType.ezrichtext.embed_renderer.class: eZ\Publish\Core\MVC\Symfony\FieldType\RichText\EmbedRenderer - ezpublish.fieldType.ezrichtext.renderer.class: eZ\Publish\Core\MVC\Symfony\FieldType\RichText\Renderer - ezpublish.fieldType.ezrichtext.tag.namespace: fieldtypes.ezrichtext.tags - ezpublish.fieldType.ezrichtext.embed.namespace: fieldtypes.ezrichtext.embed - ezpublish.fieldType.ezrichtext.converter.dispatcher.class: eZ\Publish\Core\FieldType\RichText\ConverterDispatcher - ezpublish.fieldType.ezrichtext.validator.xml.class: eZ\Publish\Core\FieldType\RichText\Validator - ezpublish.fieldType.ezrichtext.validator.dispatcher.class: eZ\Publish\Core\FieldType\RichText\ValidatorDispatcher - ezpublish.fieldType.ezrichtext.resources: %ezpublish.kernel.root_dir%/eZ/Publish/Core/FieldType/RichText/Resources - - ezpublish.fieldType.ezrichtext.converter.input.ezxml.resources: %ezpublish.fieldType.ezrichtext.resources%/stylesheets/ezxml/docbook/core.xsl - ezpublish.fieldType.ezrichtext.converter.input.xhtml5.resources: %ezpublish.fieldType.ezrichtext.resources%/stylesheets/xhtml5/edit/docbook.xsl - ezpublish.fieldType.ezrichtext.converter.edit.xhtml5.resources: %ezpublish.fieldType.ezrichtext.resources%/stylesheets/docbook/xhtml5/edit/xhtml5.xsl - ezpublish.fieldType.ezrichtext.converter.output.xhtml5.resources: %ezpublish.fieldType.ezrichtext.resources%/stylesheets/docbook/xhtml5/output/xhtml5.xsl - ezpublish.fieldType.ezrichtext.converter.output.xhtml5.fragment.resources: %ezpublish.fieldType.ezrichtext.resources%/stylesheets/xhtml5/output/fragment.xsl - - ezpublish.fieldType.ezrichtext.validator.docbook.resources: - - %ezpublish.fieldType.ezrichtext.resources%/schemas/docbook/ezpublish.rng - - %ezpublish.fieldType.ezrichtext.resources%/schemas/docbook/docbook.iso.sch.xsl - ezpublish.fieldType.ezrichtext.validator.output.ezxhtml5.resources: - - %ezpublish.fieldType.ezrichtext.resources%/schemas/ezxhtml5/output/ezxhtml5.xsd - - # Image - ezpublish.fieldType.ezimage.pathGenerator.class: eZ\Publish\Core\FieldType\Image\PathGenerator\LegacyPathGenerator - ezpublish.fieldType.ezimage.io_service.options_provider.class: eZ\Publish\Core\FieldType\Image\IO\OptionsProvider - ezpublish.fieldType.ezimage.io_legacy.class: eZ\Publish\Core\FieldType\Image\IO\Legacy - - # BinaryFile - ezpublish.fieldType.ezbinaryfile.pathGenerator.class: eZ\Publish\Core\FieldType\BinaryBase\PathGenerator\LegacyPathGenerator - ezpublish.fieldType.ezbinarybase.downloadUrlGenerator.class: eZ\Publish\Core\MVC\Symfony\FieldType\BinaryBase\ContentDownloadUrlGenerator - services: - # Parameter providers - ezpublish.fieldType.parameterProviderRegistry: - class: %ezpublish.fieldType.parameterProviderRegistry.class% - - ezpublish.fieldType.ezdatetime.parameterProvider: - class: %ezpublish.fieldType.locale.parameterProvider.class% - arguments: [@ezpublish.locale.converter] - calls: - - [setRequestStack, [@request_stack]] - tags: - - {name: ezpublish.fieldType.parameterProvider, alias: ezdatetime} - - {name: ezpublish.fieldType.parameterProvider, alias: ezdate} - - {name: ezpublish.fieldType.parameterProvider, alias: eztime} - - ezpublish.fieldType.ezpage.parameterProvider: - class: %ezpublish.fieldType.ezpage.parameterProvider.class% - arguments: [@ezpublish.fieldType.ezpage.pageService] - tags: - - {name: ezpublish.fieldType.parameterProvider, alias: ezpage} - - # Page - ezpublish.fieldType.ezpage.pageService.factory: - class: %ezpublish.fieldType.ezpage.pageService.factory.class% - - ezpublish.fieldType.ezpage.pageService: - class: %ezpublish.fieldType.ezpage.pageService.class% - factory: ["@ezpublish.fieldType.ezpage.pageService.factory", buildService] - arguments: - - %ezpublish.fieldType.ezpage.pageService.class% - - @ezpublish.config.resolver - - @ezpublish.fieldType.ezpage.storage_gateway - - @ezpublish.api.service.content - lazy: true - - ezpublish.fieldType.ezpage.hashConverter: - class: %ezpublish.fieldType.ezpage.hashConverter.class% - - # XmlText ezpublish.fieldType.ezxmltext.converter.html5: class: %ezpublish.fieldType.ezxmltext.converter.html5.class% arguments: @@ -134,162 +43,3 @@ services: - @?logger tags: - { name: ezpublish.ezxml.converter, priority: 8 } - - # RichText - # Aggregate converter for EZXML input that other converters register to - # through service tags. - ezpublish.fieldType.ezrichtext.converter.input.ezxml: - class: %ezpublish.fieldType.ezrichtext.converter.aggregate.class% - - # Input normalizing converter should typically be the first one to execute - ezpublish.fieldType.ezrichtext.converter.input.ezxml.normalize: - class: %ezpublish.fieldType.ezrichtext.converter.input.ezxml.normalize.class% - arguments: - - @ezpublish.fieldType.ezxmltext.converter.expanding - - @ezpublish.fieldType.ezxmltext.converter.embedLinking - tags: - - {name: ezpublish.ezrichtext.converter.input.ezxml, priority: 0} - - ezpublish.fieldType.ezrichtext.converter.input.ezxml.core: - class: %ezpublish.fieldType.ezrichtext.converter.xslt.class% - arguments: [%ezpublish.fieldType.ezrichtext.converter.input.ezxml.resources%] - tags: - - {name: ezpublish.ezrichtext.converter.input.ezxml, priority: 100} - - ezpublish.fieldType.ezrichtext.converter.input.xhtml5: - class: %ezpublish.fieldType.ezrichtext.converter.input.html5.class% - arguments: - - %ezpublish.fieldType.ezrichtext.converter.input.xhtml5.resources% - - @ezpublish.config.resolver - - ezpublish.fieldType.ezrichtext.converter.input.dispatcher: - class: %ezpublish.fieldType.ezrichtext.converter.dispatcher.class% - arguments: - - - http://docbook.org/ns/docbook: null - http://ez.no/namespaces/ezpublish3/xhtml/: @ezpublish.fieldType.ezrichtext.converter.input.ezxml - http://ez.no/namespaces/ezpublish5/xhtml5/edit: @ezpublish.fieldType.ezrichtext.converter.input.xhtml5 - - ezpublish.fieldType.ezrichtext.converter.link: - class: %ezpublish.fieldType.ezrichtext.converter.link.class% - arguments: [@ezpublish.api.service.location, @ezpublish.api.service.content, @ezpublish.urlalias_router, @?logger] - tags: - - {name: ezpublish.ezrichtext.converter.output.xhtml5, priority: 0} - - ezpublish.fieldType.ezrichtext.renderer: - class: %ezpublish.fieldType.ezrichtext.renderer.class% - arguments: - - @ezpublish.api.repository - - @security.authorization_checker - - @ezpublish.config.resolver - - @templating - - %ezpublish.fieldType.ezrichtext.tag.namespace% - - %ezpublish.fieldType.ezrichtext.embed.namespace% - - @?logger - - ezpublish.fieldType.ezrichtext.converter.template: - class: %ezpublish.fieldType.ezrichtext.converter.template.class% - arguments: - - @ezpublish.fieldType.ezrichtext.renderer - tags: - - {name: ezpublish.ezrichtext.converter.output.xhtml5, priority: 10} - - ezpublish.fieldType.ezrichtext.converter.embed: - class: %ezpublish.fieldType.ezrichtext.converter.embed.class% - arguments: - - @ezpublish.fieldType.ezrichtext.renderer - - @?logger - tags: - - {name: ezpublish.ezrichtext.converter.output.xhtml5, priority: 10} - - ezpublish.fieldType.ezrichtext.converter.output.xhtml5.core: - class: %ezpublish.fieldType.ezrichtext.converter.output.html5.class% - arguments: - - %ezpublish.fieldType.ezrichtext.converter.output.xhtml5.resources% - - @ezpublish.config.resolver - tags: - - {name: ezpublish.ezrichtext.converter.output.xhtml5, priority: 50} - - # Note: should typically be the last one as it produces embeddable fragment - ezpublish.fieldType.ezrichtext.converter.output.xhtml5.fragment: - class: %ezpublish.fieldType.ezrichtext.converter.xslt.class% - arguments: [%ezpublish.fieldType.ezrichtext.converter.output.xhtml5.fragment.resources%] - tags: - - {name: ezpublish.ezrichtext.converter.output.xhtml5, priority: 100} - - # Aggregate converter for XHTML5 output that other converters register to - # through service tags. - ezpublish.fieldType.ezrichtext.converter.output.xhtml5: - class: %ezpublish.fieldType.ezrichtext.converter.aggregate.class% - lazy: true - - ezpublish.fieldType.ezrichtext.converter.edit.xhtml5: - class: %ezpublish.fieldType.ezrichtext.converter.edit.html5.class% - arguments: - - %ezpublish.fieldType.ezrichtext.converter.edit.xhtml5.resources% - - @ezpublish.config.resolver - - ezpublish.fieldType.ezrichtext.validator.docbook: - class: %ezpublish.fieldType.ezrichtext.validator.xml.class% - arguments: [%ezpublish.fieldType.ezrichtext.validator.docbook.resources%] - - ezpublish.fieldType.ezrichtext.validator.output.ezxhtml5: - class: %ezpublish.fieldType.ezrichtext.validator.xml.class% - arguments: [%ezpublish.fieldType.ezrichtext.validator.output.ezxhtml5.resources%] - - ezpublish.fieldType.ezrichtext.validator.input.dispatcher: - class: %ezpublish.fieldType.ezrichtext.validator.dispatcher.class% - arguments: - - - http://docbook.org/ns/docbook: null - http://ez.no/namespaces/ezpublish5/xhtml5/edit: null - http://ez.no/namespaces/ezpublish5/xhtml5: @ezpublish.fieldType.ezrichtext.validator.output.ezxhtml5 - - # Image - ezpublish.fieldType.ezimage.io_service: - class: %ezpublish.fieldType.ezimage.io_legacy.class% - arguments: - - @ezpublish.fieldType.ezimage.io_service.published - - @ezpublish.fieldType.ezimage.io_service.draft - - @ezpublish.fieldType.ezimage.io_service.options_provider - # Required by ezpublish.core.io.stream_file_listener. Request listeners are initialized very early. - lazy: true - - ezpublish.fieldType.ezimage.io_service.options_provider: - class: %ezpublish.fieldType.ezimage.io_service.options_provider.class% - calls: - - [ setVarDir, [ "$var_dir$" ] ] - - [ setStorageDir, [ "$storage_dir$" ] ] - - [ setDraftImagesDir, [ "$image.versioned_images_dir$" ] ] - - [ setPublishedImagesDir, [ "$image.published_images_dir$" ] ] - - # Image alias generator - ezpublish.fieldType.ezimage.variation_service: - alias: ezpublish.image_alias.imagine.alias_generator - - ezpublish.fieldType.ezimage.io_service.published: - parent: ezpublish.core.io.service - calls: - - [ setPrefix, [ "$image.published_images_dir$" ] ] - - ezpublish.fieldType.ezimage.io_service.draft: - parent: ezpublish.core.io.service - calls: - - [ setPrefix, [ "$image.versioned_images_dir$" ] ] - - ezpublish.fieldType.ezimage.pathGenerator: - class: %ezpublish.fieldType.ezimage.pathGenerator.class% - - # BinaryFile - ezpublish.fieldType.ezbinaryfile.io_service: - parent: ezpublish.core.io.service - calls: - - [ setPrefix, [ "$binary_dir$" ] ] - - ezpublish.fieldType.ezbinaryfile.pathGenerator: - class: %ezpublish.fieldType.ezbinaryfile.pathGenerator.class% - - # Will be added to binaryfile & mediafile external storage handlers by a compiler pass - ezpublish.fieldType.ezbinarybase.download_url_generator: - class: %ezpublish.fieldType.ezbinarybase.downloadUrlGenerator.class% - arguments: [@router] diff --git a/bundle/Resources/config/services.yml b/bundle/Resources/config/services.yml index 7379f699..13780d6a 100644 --- a/bundle/Resources/config/services.yml +++ b/bundle/Resources/config/services.yml @@ -1,406 +1,8 @@ parameters: - ezpublish_rest.routing.options_loader.class: eZ\Bundle\EzPublishRestBundle\Routing\OptionsLoader - ezpublish_rest.routing.options_loader.route_collection_mapper.class: eZ\Bundle\EzPublishRestBundle\Routing\OptionsLoader\RouteCollectionMapper - ezpublish_rest.routing.options_loader.mapper.class: eZ\Bundle\EzPublishRestBundle\Routing\OptionsLoader\Mapper - - ezpublish_rest.cors_options_provider.class: eZ\Bundle\EzPublishRestBundle\CorsOptions\RestProvider - - ezpublish_rest.controller.base.class: eZ\Publish\Core\REST\Server\Controller - ezpublish_rest.controller.binary_content.class: eZ\Publish\Core\REST\Server\Controller\BinaryContent - ezpublish_rest.controller.content.class: eZ\Publish\Core\REST\Server\Controller\Content - ezpublish_rest.controller.content_type.class: eZ\Publish\Core\REST\Server\Controller\ContentType - ezpublish_rest.controller.location.class: eZ\Publish\Core\REST\Server\Controller\Location - ezpublish_rest.controller.object_state.class: eZ\Publish\Core\REST\Server\Controller\ObjectState - ezpublish_rest.controller.role.class: eZ\Publish\Core\REST\Server\Controller\Role - ezpublish_rest.controller.root.class: eZ\Publish\Core\REST\Server\Controller\Root - ezpublish_rest.controller.section.class: eZ\Publish\Core\REST\Server\Controller\Section - ezpublish_rest.controller.trash.class: eZ\Publish\Core\REST\Server\Controller\Trash - ezpublish_rest.controller.user.class: eZ\Publish\Core\REST\Server\Controller\User - ezpublish_rest.controller.url_wildcard.class: eZ\Publish\Core\REST\Server\Controller\URLWildcard - ezpublish_rest.controller.url_alias.class: eZ\Publish\Core\REST\Server\Controller\URLAlias - ezpublish_rest.controller.options.class: eZ\Publish\Core\REST\Server\Controller\Options - ezpublish_rest.controller.services.class: eZ\Publish\Core\REST\Server\Controller\Services - ezpublish_rest.controller.views.class: eZ\Publish\Core\REST\Server\Controller\Views - - ezpublish_rest.factory.class: eZ\Bundle\EzPublishRestBundle\ApiLoader\Factory - ezpublish_rest.request_parser.class: eZ\Bundle\EzPublishRestBundle\RequestParser\Router - ezpublish_rest.parser_tools.class: eZ\Publish\Core\REST\Common\Input\ParserTools - ezpublish_rest.field_type_parser.class: eZ\Publish\Core\REST\Common\Input\FieldTypeParser - ezpublish_rest.field_type_serializer.class: eZ\Publish\Core\REST\Common\Output\FieldTypeSerializer - - ezpublish_rest.request_listener.class: eZ\Bundle\EzPublishRestBundle\EventListener\RequestListener - ezpublish_rest.csrf_listener.class: eZ\Bundle\EzPublishRestBundle\EventListener\CsrfListener - ezpublish_rest.response_listener.class: eZ\Bundle\EzPublishRestBundle\EventListener\ResponseListener - - ezpublish_rest.field_type_processor_registry.class: eZ\Publish\Core\REST\Common\FieldTypeProcessorRegistry - ezpublish_rest.field_type_processor.ezimage.class: eZ\Publish\Core\REST\Common\FieldTypeProcessor\ImageProcessor - ezpublish_rest.field_type_processor.ezdatetime.class: eZ\Publish\Core\REST\Common\FieldTypeProcessor\DateAndTimeProcessor - ezpublish_rest.field_type_processor.ezdate.class: eZ\Publish\Core\REST\Common\FieldTypeProcessor\DateProcessor - ezpublish_rest.field_type_processor.ezmedia.class: eZ\Publish\Core\REST\Common\FieldTypeProcessor\MediaProcessor - ezpublish_rest.field_type_processor.ezobjectrelationlist.class: eZ\Publish\Core\REST\Common\FieldTypeProcessor\RelationListProcessor - ezpublish_rest.field_type_processor.ezobjectrelation.class: eZ\Publish\Core\REST\Common\FieldTypeProcessor\RelationProcessor - ezpublish_rest.field_type_processor.eztime.class: eZ\Publish\Core\REST\Common\FieldTypeProcessor\TimeProcessor - ezpublish_rest.field_type_processor.ezrichtext.class: eZ\Publish\Core\REST\Common\FieldTypeProcessor\RichTextProcessor ezpublish_rest.field_type_processor.ezxmltext.class: eZ\Publish\Core\REST\Common\FieldTypeProcessor\XmlTextProcessor - ezpublish_rest.field_type_processor.ezbinaryfile.class: eZ\Publish\Core\REST\Common\FieldTypeProcessor\BinaryProcessor - ezpublish_rest.field_type_processor.ezpage.class: eZ\Publish\Core\REST\Common\FieldTypeProcessor\PageProcessor - ezpublish_rest.field_type_processor.ezfloat.class: eZ\Publish\Core\REST\Common\FieldTypeProcessor\FloatProcessor - - ezpublish_rest.output.visitor.dispatcher.class: eZ\Publish\Core\REST\Server\View\AcceptHeaderVisitorDispatcher - ezpublish_rest.output.visitor.class: eZ\Publish\Core\REST\Common\Output\Visitor - ezpublish_rest.output.generator.json.class: eZ\Publish\Core\REST\Common\Output\Generator\Json - ezpublish_rest.output.generator.json.field_type_hash_generator.class: eZ\Publish\Core\REST\Common\Output\Generator\Json\FieldTypeHashGenerator - ezpublish_rest.output.generator.xml.class: eZ\Publish\Core\REST\Common\Output\Generator\Xml - ezpublish_rest.output.generator.xml.field_type_hash_generator.class: eZ\Publish\Core\REST\Common\Output\Generator\Xml\FieldTypeHashGenerator - ezpublish_rest.output.visitor.json.regexps: - - '(^application/vnd\.ez\.api\.[A-Za-z]+\+json$)' - - '(^application/json$)' - ezpublish_rest.output.visitor.xml.regexps: - - '(^application/vnd\.ez\.api\.[A-Za-z]+\+xml$)' - - '(^application/xml$)' - - '(^.*/.*$)' - - ezpublish_rest.output.value_object_visitor.dispatcher.class: eZ\Publish\Core\REST\Common\Output\ValueObjectVisitorDispatcher - ezpublish_rest.output.value_object_visitor.Exception.InvalidArgumentException.class: eZ\Publish\Core\REST\Server\Output\ValueObjectVisitor\InvalidArgumentException - - ezpublish_rest.input.dispatcher.class: eZ\Publish\Core\REST\Common\Input\Dispatcher - ezpublish_rest.input.parsing_dispatcher.class: eZ\Publish\Core\REST\Common\Input\ParsingDispatcher - - ezpublish_rest.input.handler.json.class: eZ\Publish\Core\REST\Common\Input\Handler\Json - ezpublish_rest.input.handler.xml.class: eZ\Publish\Core\REST\Common\Input\Handler\Xml - - ezpublish_rest.templated_router.class: %router.class% services: - ezpublish_rest.routing.options_loader: - class: %ezpublish_rest.routing.options_loader.class% - arguments: - - @ezpublish_rest.routing.options_loader.route_collection_mapper - - @ezpublish_rest.templated_router - tags: - - { name: routing.loader } - - ezpublish_rest.routing.options_loader.route_collection_mapper: - class: %ezpublish_rest.routing.options_loader.route_collection_mapper.class% - arguments: - - @ezpublish_rest.routing.options_loader.mapper - - ezpublish_rest.routing.options_loader.mapper: - class: %ezpublish_rest.routing.options_loader.mapper.class% - - ezpublish_rest.cors_option_provider: - class: %ezpublish_rest.cors_options_provider.class% - arguments: [@router.default] - tags: - - { name: nelmio_cors.options_provider } - - ezpublish_rest.field_type_serializer: - class: %ezpublish_rest.field_type_serializer.class% - arguments: - - @ezpublish.api.service.field_type - - @ezpublish_rest.field_type_processor_registry - - ezpublish_rest.request_parser: - class: %ezpublish_rest.request_parser.class% - arguments: - - @router - - ezpublish_rest.parser_tools: - class: %ezpublish_rest.parser_tools.class% - - ezpublish_rest.field_type_parser: - class: %ezpublish_rest.field_type_parser.class% - arguments: - - @ezpublish.api.service.content - - @ezpublish.api.service.content_type - - @ezpublish.api.service.field_type - - @ezpublish_rest.field_type_processor_registry - - ezpublish_rest.factory: - class: %ezpublish_rest.factory.class% - arguments: [@ezpublish.config.resolver, @ezpublish.api.repository] - calls: - - [setRequestStack, [@request_stack]] - - ezpublish_rest.controller.base: - class: %ezpublish_rest.controller.base.class% - calls: - - [ setContainer, [@service_container] ] - - [ setInputDispatcher, [@ezpublish_rest.input.dispatcher] ] - - [ setRouter, [@router] ] - - [ setRequestParser, [@ezpublish_rest.request_parser] ] - - [ setRepository, [@ezpublish.api.repository] ] - - ezpublish_rest.controller.root: - class: %ezpublish_rest.controller.root.class% - parent: ezpublish_rest.controller.base - - ezpublish_rest.controller.section: - class: %ezpublish_rest.controller.section.class% - parent: ezpublish_rest.controller.base - arguments: - - @ezpublish.api.service.section - - ezpublish_rest.controller.binary_content: - class: %ezpublish_rest.controller.binary_content.class% - parent: ezpublish_rest.controller.base - arguments: - - @ezpublish.fieldType.ezimage.variation_service - - ezpublish_rest.controller.content: - class: %ezpublish_rest.controller.content.class% - parent: ezpublish_rest.controller.base - - ezpublish_rest.controller.content_type: - class: %ezpublish_rest.controller.content_type.class% - parent: ezpublish_rest.controller.base - arguments: - - @ezpublish.api.service.content_type - - ezpublish_rest.controller.role: - class: %ezpublish_rest.controller.role.class% - parent: ezpublish_rest.controller.base - arguments: - - @ezpublish.api.service.role - - @ezpublish.api.service.user - - @ezpublish.api.service.location - - ezpublish_rest.controller.location: - class: %ezpublish_rest.controller.location.class% - parent: ezpublish_rest.controller.base - arguments: - - @ezpublish.api.service.location - - @ezpublish.api.service.content - - @ezpublish.api.service.trash - - ezpublish_rest.controller.object_state: - class: %ezpublish_rest.controller.object_state.class% - parent: ezpublish_rest.controller.base - arguments: - - @ezpublish.api.service.object_state - - @ezpublish.api.service.content - - ezpublish_rest.controller.trash: - class: %ezpublish_rest.controller.trash.class% - parent: ezpublish_rest.controller.base - arguments: - - @ezpublish.api.service.trash - - @ezpublish.api.service.location - - ezpublish_rest.controller.user: - class: %ezpublish_rest.controller.user.class% - parent: ezpublish_rest.controller.base - arguments: - - @ezpublish.api.service.user - - @ezpublish.api.service.role - - @ezpublish.api.service.content - - @ezpublish.api.service.content_type - - @ezpublish.api.service.location - - @ezpublish.api.service.section - - @ezpublish.api.repository - - ezpublish_rest.controller.url_wildcard: - class: %ezpublish_rest.controller.url_wildcard.class% - parent: ezpublish_rest.controller.base - arguments: - - @ezpublish.api.service.url_wildcard - - ezpublish_rest.controller.url_alias: - class: %ezpublish_rest.controller.url_alias.class% - parent: ezpublish_rest.controller.base - arguments: - - @ezpublish.api.service.url_alias - - @ezpublish.api.service.location - - ezpublish_rest.controller.views: - class: %ezpublish_rest.controller.views.class% - parent: ezpublish_rest.controller.base - arguments: - - @ezpublish.api.service.search - - ezpublish_rest.request_listener: - class: %ezpublish_rest.request_listener.class% - arguments: - - %ezpublish_rest.path_prefix% - tags: - - { name: kernel.event_subscriber } - - ezpublish_rest.response_listener: - class: %ezpublish_rest.response_listener.class% - arguments: - - @ezpublish_rest.output.visitor.dispatcher - tags: - - { name: kernel.event_subscriber } - - ezpublish_rest.csrf_listener: - class: %ezpublish_rest.csrf_listener.class% - arguments: - - @event_dispatcher - - %form.type_extension.csrf.enabled% - - %ezpublish_rest.csrf_token_intention% - - @?security.csrf.token_manager - tags: - - { name: kernel.event_subscriber } - - ezpublish_rest.controller.options: - class: %ezpublish_rest.controller.options.class% - parent: ezpublish_rest.controller.base - - ezpublish_rest.controller.services: - class: %ezpublish_rest.controller.services.class% - arguments: [%ezpublish.fieldType.ezcountry.data%] - - ezpublish_rest.field_type_processor_registry: - class: %ezpublish_rest.field_type_processor_registry.class% - lazy: true - - ezpublish_rest.field_type_processor.ezimage: - class: %ezpublish_rest.field_type_processor.ezimage.class% - factory: ["@ezpublish_rest.factory", getImageFieldTypeProcessor] - arguments: - - @router - tags: - - { name: ezpublish_rest.field_type_processor, alias: ezimage } - - ezpublish_rest.field_type_processor.ezdatetime: - class: %ezpublish_rest.field_type_processor.ezdatetime.class% - tags: - - { name: ezpublish_rest.field_type_processor, alias: ezdatetime } - - ezpublish_rest.field_type_processor.ezdate: - class: %ezpublish_rest.field_type_processor.ezdate.class% - tags: - - { name: ezpublish_rest.field_type_processor, alias: ezdate } - - ezpublish_rest.field_type_processor.ezmedia: - class: %ezpublish_rest.field_type_processor.ezmedia.class% - factory: ["@ezpublish_rest.factory", getMediaFieldTypeProcessor] - tags: - - { name: ezpublish_rest.field_type_processor, alias: ezmedia } - - ezpublish_rest.field_type_processor.ezobjectrelationlist: - class: %ezpublish_rest.field_type_processor.ezobjectrelationlist.class% - tags: - - { name: ezpublish_rest.field_type_processor, alias: ezobjectrelationlist } - - ezpublish_rest.field_type_processor.ezobjectrelation: - class: %ezpublish_rest.field_type_processor.ezobjectrelation.class% - tags: - - { name: ezpublish_rest.field_type_processor, alias: ezobjectrelation } - - ezpublish_rest.field_type_processor.eztime: - class: %ezpublish_rest.field_type_processor.eztime.class% - tags: - - { name: ezpublish_rest.field_type_processor, alias: eztime } - - ezpublish_rest.field_type_processor.ezrichtext: - class: %ezpublish_rest.field_type_processor.ezrichtext.class% - arguments: - - @ezpublish.fieldType.ezrichtext.converter.edit.xhtml5 - tags: - - { name: ezpublish_rest.field_type_processor, alias: ezrichtext } - ezpublish_rest.field_type_processor.ezxmltext: class: %ezpublish_rest.field_type_processor.ezxmltext.class% tags: - { name: ezpublish_rest.field_type_processor, alias: ezxmltext } - - ezpublish_rest.field_type_processor.ezbinaryfile: - class: %ezpublish_rest.field_type_processor.ezbinaryfile.class% - factory: ["@ezpublish_rest.factory", getBinaryFileFieldTypeProcessor] - arguments: - - @ezpublish.core.io.default_url_decorator - tags: - - { name: ezpublish_rest.field_type_processor, alias: ezbinaryfile } - - ezpublish_rest.field_type_processor.ezpage: - class: %ezpublish_rest.field_type_processor.ezpage.class% - tags: - - { name: ezpublish_rest.field_type_processor, alias: ezpage } - - ezpublish_rest.field_type_processor.ezfloat: - class: %ezpublish_rest.field_type_processor.ezfloat.class% - tags: - - { name: ezpublish_rest.field_type_processor, alias: ezfloat } - - ### OUTPUT - - # Main REST output dispatcher - # Gets a => output.visitor mapping with the ezpublish_rest.output.visitor tag. - ezpublish_rest.output.visitor.dispatcher: - class: %ezpublish_rest.output.visitor.dispatcher.class% - - # format output visitors - ezpublish_rest.output.visitor.json: - class: %ezpublish_rest.output.visitor.class% - arguments: - - @ezpublish_rest.output.generator.json - - @ezpublish_rest.output.value_object_visitor.dispatcher - tags: - - { name: ezpublish_rest.output.visitor, regexps: ezpublish_rest.output.visitor.json.regexps } - - ezpublish_rest.output.visitor.xml: - class: %ezpublish_rest.output.visitor.class% - arguments: - - @ezpublish_rest.output.generator.xml - - @ezpublish_rest.output.value_object_visitor.dispatcher - tags: - - { name: ezpublish_rest.output.visitor, regexps: ezpublish_rest.output.visitor.xml.regexps } - - # format output generators - ezpublish_rest.output.generator.xml: - class: %ezpublish_rest.output.generator.xml.class% - arguments: - - @ezpublish_rest.output.generator.xml.field_type_hash_generator - calls: - - [ setFormatOutput, [ %kernel.debug% ] ] - - ezpublish_rest.output.generator.xml.field_type_hash_generator: - class: %ezpublish_rest.output.generator.xml.field_type_hash_generator.class% - - ezpublish_rest.output.generator.json: - class: %ezpublish_rest.output.generator.json.class% - arguments: - - @ezpublish_rest.output.generator.json.field_type_hash_generator - calls: - - [ setFormatOutput, [ %kernel.debug% ] ] - - ezpublish_rest.output.generator.json.field_type_hash_generator: - class: %ezpublish_rest.output.generator.json.field_type_hash_generator.class% - - # value objects visitors - ezpublish_rest.output.value_object_visitor.dispatcher: - class: %ezpublish_rest.output.value_object_visitor.dispatcher.class% - - ezpublish_rest.output.value_object_visitor.Exception.InvalidArgumentException: - class: %ezpublish_rest.output.value_object_visitor.Exception.InvalidArgumentException.class% - tags: - - { name: ezpublish_rest.output.value_object_visitor, type: \eZ\Publish\API\Repository\Exceptions\InvalidArgumentException } - - ezpublish_rest.input.dispatcher: - class: %ezpublish_rest.input.dispatcher.class% - arguments: - - @ezpublish_rest.input.parsing_dispatcher - - [] - - @ezpublish_rest.request_parser - - @ezpublish_rest.parser_tools - - @ezpublish_rest.field_type_parser - - ezpublish_rest.input.parsing_dispatcher: - class: %ezpublish_rest.input.parsing_dispatcher.class% - - ezpublish_rest.input.handler.json: - class: %ezpublish_rest.input.handler.json.class% - tags: - - { name: ezpublish_rest.input.handler, format: json } - - ezpublish_rest.input.handler.xml: - class: %ezpublish_rest.input.handler.xml.class% - tags: - - { name: ezpublish_rest.input.handler, format: xml } - - ezpublish_rest.templated_router: - class: %ezpublish_rest.templated_router.class% - parent: hautelook.router.template - calls: - - [ setOption, [ strict_requirements, ~ ] ] diff --git a/bundle/Resources/config/templating.yml b/bundle/Resources/config/templating.yml index e5bae124..de428f2f 100644 --- a/bundle/Resources/config/templating.yml +++ b/bundle/Resources/config/templating.yml @@ -1,167 +1,9 @@ parameters: - twig.extension.intl.class: Twig_Extensions_Extension_Intl - - ezpublish.twig.extension.content.class: eZ\Publish\Core\MVC\Symfony\Templating\Twig\Extension\ContentExtension - - ezpublish.view_manager.class: eZ\Bundle\EzPublishCoreBundle\View\Manager - ezpublish.content_view.matcher_factory.class: eZ\Bundle\EzPublishCoreBundle\Matcher\ContentMatcherFactory - ezpublish.location_view.matcher_factory.class: eZ\Bundle\EzPublishCoreBundle\Matcher\LocationMatcherFactory - ezpublish.block_view.matcher_factory.class: eZ\Bundle\EzPublishCoreBundle\Matcher\BlockMatcherFactory - ezpublish.content_view_provider.configured.class: eZ\Bundle\EzPublishCoreBundle\View\Provider\ContentConfigured - ezpublish.location_view_provider.configured.class: eZ\Bundle\EzPublishCoreBundle\View\Provider\LocationConfigured - ezpublish.block_view_provider.configured.class: eZ\Bundle\EzPublishCoreBundle\View\Provider\BlockConfigured - ezpublish.content_view.viewbase_layout: "EzPublishCoreBundle::viewbase_layout.html.twig" - ezpublish.content_view.content_block_name: "content" - ezpublish.view.custom_location_controller_checker.class: eZ\Publish\Core\MVC\Symfony\View\CustomLocationControllerChecker - - ezpublish.templating.global_helper.core.class: eZ\Publish\Core\MVC\Symfony\Templating\GlobalHelper - ezpublish.twig.extension.core.class: eZ\Publish\Core\MVC\Symfony\Templating\Twig\Extension\CoreExtension - ezpublish.twig.extension.filesize.class: eZ\Publish\Core\MVC\Symfony\Templating\Twig\Extension\FileSizeExtension - ezpublish.twig.extension.filesize.suffixes: ['B', 'kB', 'MB', 'GB', 'TB', 'PB', 'EB'] - ezpublish.templating.extension.routing.class: eZ\Publish\Core\MVC\Symfony\Templating\Twig\Extension\RoutingExtension - ezpublish.templating.field_block_renderer.twig.class: eZ\Publish\Core\MVC\Symfony\Templating\Twig\FieldBlockRenderer - ezpublish.twig.extension.field_rendering.class: eZ\Publish\Core\MVC\Symfony\Templating\Twig\Extension\FieldRenderingExtension - ezpublish.twig.extension.image.class: eZ\Publish\Core\MVC\Symfony\Templating\Twig\Extension\ImageExtension - ezpublish.twig.extension.xml_text.class: eZ\Publish\Core\MVC\Symfony\Templating\Twig\Extension\XmlTextExtension - ezpublish.twig.extension.rich_text.class: eZ\Publish\Core\MVC\Symfony\Templating\Twig\Extension\RichTextExtension - - assetic.asset_factory.class: eZ\Bundle\EzPublishCoreBundle\Assetic\AssetFactory + ezpublish.twig.extension.xml_text.class: EzSystems\EzPlatformXmlTextFieldTypeBundle\Templating\Twig\Extension\XmlTextExtension services: - twig.extension.intl: - class: %twig.extension.intl.class% - tags: - - {name: twig.extension} - - ezpublish.twig.extension.content: - class: %ezpublish.twig.extension.content.class% - arguments: - - @ezpublish.api.repository - - @ezpublish.translation_helper - - @ezpublish.field_helper - - @?logger - tags: - - {name: twig.extension} - - ezpublish.view_manager: - class: %ezpublish.view_manager.class% - arguments: - - @templating - - @event_dispatcher - - @ezpublish.api.repository - - @ezpublish.config.resolver - - %ezpublish.content_view.viewbase_layout% - - @?logger - - ezpublish.content_view_provider.configured: - class: %ezpublish.content_view_provider.configured.class% - arguments: [@ezpublish.content_view.matcher_factory] - tags: - - {name: ezpublish.content_view_provider, priority: 10} - - {name: ezpublish.view_provider, type: 'eZ\Publish\API\Repository\Values\Content', priority: 10} - - ezpublish.content_view.matcher_factory: - class: %ezpublish.content_view.matcher_factory.class% - arguments: [@ezpublish.config.resolver, @ezpublish.api.repository] - calls: - - [setContainer, [@service_container]] - - ezpublish.location_view_provider.configured: - class: %ezpublish.location_view_provider.configured.class% - arguments: [@ezpublish.location_view.matcher_factory] - tags: - - {name: ezpublish.location_view_provider, priority: 10} - - {name: ezpublish.view_provider, type: 'eZ\Publish\API\Repository\Values\Content\Location', priority: 10} - - ezpublish.location_view.matcher_factory: - class: %ezpublish.location_view.matcher_factory.class% - arguments: [@ezpublish.config.resolver, @ezpublish.api.repository] - calls: - - [setContainer, [@service_container]] - - ezpublish.block_view_provider.configured: - class: %ezpublish.block_view_provider.configured.class% - arguments: [@ezpublish.block_view.matcher_factory] - tags: - - {name: ezpublish.block_view_provider, priority: 10} - - {name: ezpublish.view_provider, type: 'eZ\Publish\Core\FieldType\Page\Parts\Block', priority: 10} - - ezpublish.block_view.matcher_factory: - class: %ezpublish.block_view.matcher_factory.class% - arguments: [@ezpublish.config.resolver, @ezpublish.api.repository] - calls: - - [setContainer, [@service_container]] - - ezpublish.templating.global_helper.core: - class: %ezpublish.templating.global_helper.core.class% - arguments: [@ezpublish.config.resolver, @ezpublish.api.service.location, @router, @ezpublish.translation_helper] - calls: - - [setRequestStack, [@request_stack]] - - ezpublish.templating.global_helper: - alias: ezpublish.templating.global_helper.core - - ezpublish.twig.extension.core: - class: %ezpublish.twig.extension.core.class% - arguments: [@ezpublish.templating.global_helper] - tags: - - {name: twig.extension} - - ezpublish.twig.extension.filesize: - class: %ezpublish.twig.extension.filesize.class% - arguments: [@translator, %ezpublish.twig.extension.filesize.suffixes%, @ezpublish.config.resolver, @ezpublish.locale.converter ] - tags: - - {name: twig.extension} - - ezpublish.templating.extension.routing: - class: %ezpublish.templating.extension.routing.class% - arguments: [@ezpublish.route_reference.generator] - tags: - - {name: twig.extension} - - ezpublish.templating.field_block_renderer.twig: - class: %ezpublish.templating.field_block_renderer.twig.class% - calls: - - [setTwig, [@twig]] - - [setBaseTemplate, [%ezpublish.content_view.viewbase_layout%]] - - [setFieldViewResources, ["$field_templates$"]] - - [setFieldEditResources, ["$field_edit_templates$"]] - - [setFieldDefinitionViewResources, ["$fielddefinition_settings_templates$"]] - - [setFieldDefinitionEditResources, ["$fielddefinition_edit_templates$"]] - - ezpublish.templating.field_block_renderer: - alias: ezpublish.templating.field_block_renderer.twig - - ezpublish.twig.extension.field_rendering: - class: %ezpublish.twig.extension.field_rendering.class% - arguments: - - @ezpublish.templating.field_block_renderer - - @ezpublish.api.service.content_type - - @ezpublish.fieldType.parameterProviderRegistry - - @ezpublish.translation_helper - tags: - - { name: twig.extension } - - ezpublish.twig.extension.image: - class: %ezpublish.twig.extension.image.class% - arguments: [@ezpublish.fieldtype.ezimage.variation_service] - tags: - - { name: twig.extension } - ezpublish.twig.extension.xml_text: class: %ezpublish.twig.extension.xml_text.class% arguments: [@ezpublish.fieldtype.ezxmltext.converter.html5] tags: - { name: twig.extension } - - ezpublish.twig.extension.rich_text: - class: %ezpublish.twig.extension.rich_text.class% - arguments: - - @ezpublish.fieldType.ezrichtext.converter.output.xhtml5 - - @ezpublish.fieldType.ezrichtext.converter.edit.xhtml5 - tags: - - { name: twig.extension } - - - ezpublish.view.custom_location_controller_checker: - class: %ezpublish.view.custom_location_controller_checker.class% diff --git a/bundle/Resources/views/content_fields.html.twig b/bundle/Resources/views/content_fields.html.twig index 411eb407..355a54a4 100644 --- a/bundle/Resources/views/content_fields.html.twig +++ b/bundle/Resources/views/content_fields.html.twig @@ -1,469 +1,4 @@ -{# Template blocks to be used by content fields #} -{# Block naming convention is _field #} -{# Following variables are passed: - # - \eZ\Publish\API\Repository\Values\Content\Field field the field to display - # - \eZ\Publish\API\Repository\Values\Content\ContentInfo contentInfo the contentInfo to which the field belongs to - # - \eZ\Publish\API\Repository\Values\Content\VersionInfo versionInfo the versionInfo to which the field belongs to - # - mixed fieldSettings settings of the field (depends on the fieldtype) - # - array parameters options passed to ez_render_field under the parameters key - # - array attr the attributes to add the generate HTML, contains at least a "class" entry - # containing -field - #} - -{% block ezstring_field %} -{% spaceless %} - {% set field_value = field.value.text %} - {{ block( 'simple_inline_field' ) }} -{% endspaceless %} -{% endblock %} - -{% block eztext_field %} -{% spaceless %} - {% set field_value = field.value|nl2br %} - {{ block( 'simple_block_field' ) }} -{% endspaceless %} -{% endblock %} - {% block ezxmltext_field %} {%- set field_value = field.value.xml|xmltext_to_html5 -%} {{ block( 'simple_block_field' ) }} {% endblock %} - -{% block ezrichtext_field %} - {%- set field_value = field.value.xml|richtext_to_html5 -%} - {{ block( 'simple_block_field' ) }} -{% endblock %} - -{% block ezauthor_field %} -{% spaceless %} - {% if field.value.authors|length() > 0 %} - - {% endif %} -{% endspaceless %} -{% endblock %} - -{% block ezcountry_field %} -{% spaceless %} - {% if fieldSettings.isMultiple and field.value.countries|length > 0 %} -
    - {% for country in field.value.countries %} -
  • {{ country['Name'] }}
  • - {% endfor %} -
- {% elseif field.value.countries|length() == 1 %} -

- {% for country in field.value.countries %} - {{ country['Name'] }} - {% endfor %} -

- {% endif %} -{% endspaceless %} -{% endblock %} - -{# @todo: add translate filter #} -{% block ezboolean_field %} -{% spaceless %} - {% set field_value = field.value.bool ? 'Yes' : 'No' %} - {{ block( 'simple_inline_field' ) }} -{% endspaceless %} -{% endblock %} - -{% block ezdatetime_field %} -{% spaceless %} - {% if not ez_is_field_empty( content, field ) %} - {% if fieldSettings.useSeconds %} - {% set field_value = field.value.value|localizeddate( 'short', 'medium', parameters.locale ) %} - {% else %} - {% set field_value = field.value.value|localizeddate( 'short', 'short', parameters.locale ) %} - {% endif %} - {{ block( 'simple_block_field' ) }} - {% endif %} -{% endspaceless %} -{% endblock %} - -{% block ezdate_field %} -{% spaceless %} - {% if not ez_is_field_empty( content, field ) %} - {% set field_value = field.value.date|localizeddate( 'short', 'none', parameters.locale ) %} - {{ block( 'simple_block_field' ) }} - {% endif %} -{% endspaceless %} -{% endblock %} - -{% block eztime_field %} -{% spaceless %} - {% if not ez_is_field_empty( content, field ) %} - {% if fieldSettings.useSeconds %} - {% set field_value = field.value.time|localizeddate( 'none', 'medium', parameters.locale ) %} - {% else %} - {% set field_value = field.value.time|localizeddate( 'none', 'short', parameters.locale ) %} - {% endif %} - {{ block( 'simple_block_field' ) }} - {% endif %} -{% endspaceless %} -{% endblock %} - -{% block ezemail_field %} -{% spaceless %} - {% if not ez_is_field_empty( content, field ) %} - {% set field_value = field.value.email %} - {{ field.value.email }} - {% endif %} -{% endspaceless %} -{% endblock %} - -{% block ezinteger_field %} -{% spaceless %} - {% if not ez_is_field_empty( content, field ) %} - {% set field_value = field.value.value %} - {{ block( 'simple_inline_field' ) }} - {% endif %} -{% endspaceless %} -{% endblock %} - -{# @todo: handle localization #} -{% block ezfloat_field %} -{% spaceless %} - {% if not ez_is_field_empty( content, field ) %} - {% set field_value = field.value.value %} - {{ block( 'simple_inline_field' ) }} - {% endif %} -{% endspaceless %} -{% endblock %} - -{% block ezurl_field %} -{% spaceless %} - {% if not ez_is_field_empty( content, field ) %} - {{ field.value.text ? field.value.text : field.value.link }} - {% endif %} -{% endspaceless %} -{% endblock %} - -{% block ezisbn_field %} -{% spaceless %} - {% set field_value = field.value.isbn %} - {{ block( 'simple_inline_field' ) }} -{% endspaceless %} -{% endblock %} - -{% block ezkeyword_field %} -{% spaceless %} - {% if not ez_is_field_empty( content, field ) %} -
    - {% for keyword in field.value.values %} -
  • {{ keyword }}
  • - {% endfor %} -
- {% endif %} -{% endspaceless %} -{% endblock %} - -{% block ezselection_field %} -{% spaceless %} - {% if fieldSettings.isMultiple and field.value.selection|length() > 0 %} -
    - {% for selectedIndex in field.value.selection %} -
  • {{ fieldSettings.options[selectedIndex] }}
  • - {% endfor %} -
- {% elseif not fieldSettings.isMultiple %} - {% set field_value = fieldSettings.options[field.value.selection.0] %} - {{ block( 'simple_block_field' ) }} - {% endif %} -{% endspaceless %} -{% endblock %} - -{# @todo: - # - add translate filter - # - legacy used to dump is_locked attribute - #} -{% block ezuser_field %} -{% spaceless %} -
-
User ID
-
{{ field.value.contentId }}
-
Username
-
{{ field.value.login }}
-
Email
-
{{ field.value.email }}
-
Account status
-
{{ field.value.enabled ? 'enabled' : 'disabled' }}
-
-{% endspaceless %} -{% endblock %} - -{% block ezbinaryfile_field %} -{% spaceless %} - {% if not ez_is_field_empty( content, field ) %} - {% set route_reference = ez_route( 'ez_content_download', { 'content': content, 'fieldIdentifier': field.fieldDefIdentifier } ) %} - {{ field.value.fileName }} ({{ field.value.fileSize|ez_file_size( 1 ) }}) - {% endif %} -{% endspaceless %} -{% endblock %} - -{% block ezmedia_field %} -{% if not ez_is_field_empty( content, field ) %} -{% spaceless %} - {% set type = fieldSettings.mediaType %} - {% set value = field.value %} - {% set route_reference = ez_route( 'ez_content_download', {'content': content, 'fieldIdentifier': field.fieldDefIdentifier} ) %} - {% set download = path( route_reference ) %} - {% set width = value.width > 0 ? 'width="' ~ value.width ~ '"' : "" %} - {% set height = value.height > 0 ? 'height="' ~ value.height ~ '"' : "" %} -
- {% autoescape false %} - {% if type == "html5_video" - or type == "quick_time" - or type == "windows_media_player" - or type == "real_player" %} - - {% elseif type == "html5_audio" %} - - {% elseif type == 'flash' %} - - - - - - - {% elseif type == 'silverlight' %} - - - - - - - Get Microsoft Silverlight - - - - {% endif %} - {% endautoescape %} -
-{% endspaceless %} -{% endif %} -{% endblock %} - -{% block ezobjectrelationlist_field %} -{% spaceless %} - {% if not ez_is_field_empty( content, field ) %} -
    - {% for contentId in field.value.destinationContentIds %} -
  • - {{ render( controller( "ez_content:viewContent", {'contentId': contentId, 'viewType': 'embed', 'noLayout': 1} ) ) }} -
  • - {% endfor %} -
- {% endif %} -{% endspaceless %} -{% endblock %} - -{# @todo: - # - include Gmaps JS only once if the field is used several times in the page - # - add translate filter - #} -{% block ezgmaplocation_field %} -{## - # This field type block accepts the following parameters: - # - string mapType the Google map type (ROADMAP, SATELLITE, HYBRID or TERRAIN), default is ROADMAP - # - boolean showMap whether to show the Google map or not, default is true - # - boolean showInfo whether to show the latitude, longitude and address or not, default is true - # - integer zoom the default zoom level, default is 13 - # - boolean draggable whether to enable or not draggable map (useful on mobile / responsive layout), default is true - # - string|false width the width of the rendered map with its unit (ie "500px" or "50em"), - # set to false to not set any width style inline, default is 500px - # - string|boolean height the height of the rendered map with its unit (ie "200px" or "20em"), - # set to false to not set any height style inline, default is 200px - #} -{% spaceless %} -
- {% set defaultWidth = '500px' %} - {% set defaultHeight = '200px' %} - {% set defaultShowMap = true %} - {% set defaultShowInfo = true %} - {% set defaultZoom = 13 %} - {% set defaultMapType = 'ROADMAP' %} - {% set defaultDraggable = 'true' %} - - {% set hasContent = field.value is not null %} - {% set latitude = field.value.latitude|default( 0 ) %} - {% set longitude = field.value.longitude|default( 0 ) %} - {% set address = field.value.address|default( "" ) %} - {% set mapId = "maplocation-map-" ~ field.id %} - - {% set zoom = parameters.zoom|default( defaultZoom ) %} - {% set mapType = parameters.mapType|default( defaultMapType ) %} - - {% set mapWidth, mapHeight = defaultWidth, defaultHeight %} - {% if parameters.width is defined %} - {% set mapWidth = parameters.width %} - {% endif %} - - {% if parameters.height is defined %} - {% set mapHeight = parameters.height %} - {% endif %} - - {% set showMap = defaultShowMap %} - {% if parameters.showMap is defined and not parameters.showMap %} - {% set showMap = false %} - {% endif %} - - {% set showInfo = defaultShowInfo %} - {% if parameters.showInfo is defined and not parameters.showInfo %} - {% set showInfo = false %} - {% endif %} - - {% set draggable = defaultDraggable %} - {% if parameters.draggable is defined and not parameters.draggable %} - {% set draggable = 'false' %} - {% endif %} - - {% if showInfo %} -
-
Latitude
-
{{ hasContent ? latitude : "Not set" }}
-
Longitude
-
{{ longitude ? longitude : "Not set" }}
- {% if address %} -
Address
-
{{ address }}
- {% endif %} -
- {% endif %} - - {% if hasContent and showMap %} - - - {% set mapStyle = mapWidth ? "width:" ~ mapWidth ~ ";": "" %} - {% set mapStyle = mapHeight ? mapStyle ~ " height:" ~ mapHeight : mapStyle %} -
- {% endif %} -
-{% endspaceless %} -{% endblock %} - -{# This field accepts the following parameters: - # - alias (image variation name). Defaults to "original" (e.g. image originally uploaded) - # - parameters.width. Allows forcing width of the image in the HTML - # - parameters.height. Allows forcing height of the image in the HTML - #} -{% block ezimage_field %} -{% spaceless %} -{% if not ez_is_field_empty( content, field ) %} -
- {% set imageAlias = ez_image_alias( field, versionInfo, parameters.alias|default( 'original' ) ) %} - {% set src = imageAlias ? asset( imageAlias.uri ) : "//:0" %} - {% set width = parameters.width is defined ? parameters.width : imageAlias.width %} - {% set height = parameters.height is defined ? parameters.height : imageAlias.height %} - {{ field.value.alternativeText }} -
-{% endif %} -{% endspaceless %} -{% endblock %} - -{% block ezobjectrelation_field %} -{% spaceless %} -{% if not ez_is_field_empty( content, field ) %} -
- {{ render( controller( "ez_content:viewContent", {'contentId': field.value.destinationContentId, 'viewType': 'text_linked', 'noLayout': 1} ) ) }} -
-{% endif %} -{% endspaceless %} -{% endblock %} - -{# pageService is exposed under parameters.pageService thanks to Page\ParameterProvider #} -{% block ezpage_field %} -{% spaceless %} -{% if not ez_is_field_empty( content, field ) %} - {% set layout = field.value.page.layout %} - {% set template = parameters.pageService.getLayoutTemplate( layout ) %} - {% include template with { 'zones': field.value.page.zones, 'zone_layout': layout, 'pageService': parameters.pageService } %} -{% endif %} -{% endspaceless %} -{% endblock %} - - -{# The simple_block_field block is a shorthand html block-based fields (like eztext or ezxmltext) #} -{# You can define a field_value variable before rendering this one if you need special operation for rendering content (i.e. nl2br) #} -{% block simple_block_field %} -{% spaceless %} - {% if field_value is not defined %} - {% set field_value = field.value %} - {% endif %} -
- {% endspaceless %}{{ field_value|raw }}{% spaceless %} -
-{% endspaceless %} -{% endblock %} - -{% block simple_inline_field %} -{% spaceless %} - {% if field_value is not defined %} - {% set field_value = field.value %} - {% endif %} - {{ field_value }} -{% endspaceless %} -{% endblock %} - -{# Block for field attributes rendering. Useful to add a custom class, id or whatever HTML attribute to the field markup #} -{% block field_attributes %} -{% spaceless %} - {% set attr = attr|default( {} ) %} - {% for attrname, attrvalue in attr %}{{ attrname }}="{{ attrvalue }}" {% endfor %} -{% endspaceless %} -{% endblock %} diff --git a/bundle/Resources/views/fielddefinition_settings.html.twig b/bundle/Resources/views/fielddefinition_settings.html.twig index b615a326..9094ce44 100644 --- a/bundle/Resources/views/fielddefinition_settings.html.twig +++ b/bundle/Resources/views/fielddefinition_settings.html.twig @@ -1,25 +1,3 @@ -{# Template blocks used to render the settings of each field definition #} -{# Block naming convention is _settings> #} -{# The following variables are available in each block: - # - \eZ\Publish\API\Repository\Values\ContentType\FieldDefinition fielddefinition the field definition - # - array settings settings of the field definition - #} - -{% block ezstring_settings %} -
    - {% set defaultValue = fielddefinition.defaultValue.text %} - {{ block( 'settings_defaultvalue' ) }} -
  • - Max string length: - {% if fielddefinition.validatorConfiguration.StringLengthValidator.maxStringLength %} - {{ fielddefinition.validatorConfiguration.StringLengthValidator.maxStringLength }} characters - {% else %} - No defined maximum string length - {% endif %} -
  • -
-{% endblock %} - {% block ezxmltext_settings %}
    {% set rows = settings.numRows %} @@ -35,332 +13,3 @@
{% endblock %} - -{% block eztext_settings %} -
    - {% set rows = settings.textRows %} - {{ block( 'settings_preferredrows' ) }} -
-{% endblock %} - -{% block ezcountry_settings %} -
    - {% set defaultValue = '' %} - {% for country in fielddefinition.defaultValue.countries %} - {% set defaultValue = defaultValue ~ country.Name ~ ( not loop.last ? ', ' : '' ) %} - {% endfor %} - {{ block( 'settings_defaultvalue' ) }} - {% set isMultiple = settings.isMultiple %} - {{ block( 'settings_allowmultiple' ) }} -
-{% endblock %} - -{% block ezboolean_settings %} -
    -
  • - Default value: - {% if fielddefinition.defaultValue.bool %} - Checked - {% else %} - Unchecked - {% endif %} -
  • -
-{% endblock %} - -{% block ezdatetime_settings %} -
    - {% if settings.defaultType == constant( 'eZ\\Publish\\Core\\FieldType\\DateAndTime\\Type::DEFAULT_EMPTY' ) %} - {% set defaultValue = 'Empty' %} - {% elseif settings.defaultType == constant( 'eZ\\Publish\\Core\\FieldType\\DateAndTime\\Type::DEFAULT_CURRENT_DATE' ) %} - {% set defaultValue = 'Current datetime' %} - {% else %} - {% set interval = settings.dateInterval %} - {% set defaultValue = 'Current datetime adjusted by ' %} - {% set defaultValue = interval.y ? defaultValue ~ interval.y ~ ' year(s)' : defaultValue %} - {% set defaultValue = interval.m ? defaultValue ~ interval.m ~ ' month(s)' : defaultValue %} - {% set defaultValue = interval.d ? defaultValue ~ interval.d ~ ' day(s)' : defaultValue %} - {% set defaultValue = interval.h ? defaultValue ~ interval.h ~ ' hour(s)' : defaultValue %} - {% set defaultValue = interval.i ? defaultValue ~ interval.i ~ ' minute(s)' : defaultValue %} - {% set defaultValue = interval.s and settings.useSeconds ? defaultValue ~ interval.s ~ ' second(s)' : defaultValue %} - {% endif %} - {{ block( 'settings_defaultvalue' ) }} -
  • - Use seconds: - {{ settings.useSeconds ? 'Yes' : 'No' }} -
  • -
-{% endblock %} - -{% block ezdate_settings %} -
    - {% if settings.defaultType == constant( 'eZ\\Publish\\Core\\FieldType\\Date\\Type::DEFAULT_EMPTY' ) %} - {% set defaultValue = 'Empty' %} - {% else %} - {% set defaultValue = 'Current date' %} - {% endif %} - {{ block( 'settings_defaultvalue' ) }} -
-{% endblock %} - -{% block eztime_settings %} -
    - {% if settings.defaultType == constant( 'eZ\\Publish\\Core\\FieldType\\Time\\Type::DEFAULT_EMPTY' ) %} - {% set defaultValue = 'Empty' %} - {% else %} - {% set defaultValue = 'Current time' %} - {% endif %} - {{ block( 'settings_defaultvalue' ) }} -
  • - Use seconds: - {{ settings.useSeconds ? 'Yes' : 'No' }} -
  • -
-{% endblock %} - -{% block ezinteger_settings %} -
    - {% set defaultValue = fielddefinition.defaultValue.value %} - {{ block( 'settings_defaultvalue' ) }} - {% set minValue = fielddefinition.validatorConfiguration.IntegerValueValidator.minIntegerValue %} - {{ block( 'settings_minimumvalue' ) }} - {% set maxValue = fielddefinition.validatorConfiguration.IntegerValueValidator.maxIntegerValue %} - {{ block( 'settings_maximumvalue' ) }} -
-{% endblock %} - -{% block ezfloat_settings %} -
    - {% set defaultValue = fielddefinition.defaultValue.value %} - {{ block( 'settings_defaultvalue' ) }} - {% set minValue = fielddefinition.validatorConfiguration.FloatValueValidator.minFloatValue %} - {{ block( 'settings_minimumvalue' ) }} - {% set maxValue = fielddefinition.validatorConfiguration.FloatValueValidator.maxFloatValue %} - {{ block( 'settings_maximumvalue' ) }} -
-{% endblock %} - -{% block ezselection_settings %} -
    -
  • - Defined options -
      - {% for option in settings.options %} -
    • {{ option }}
    • - {% endfor %} -
    -
  • - {% set isMultiple = settings.isMultiple %} - {{ block( 'settings_allowmultiple' ) }} -
-{% endblock %} - - -{% block ezbinaryfile_settings %} -
    - {{ block( 'settings_maxfilesize' ) }} -
-{% endblock %} - -{% block ezmedia_settings %} -{% set type = settings.mediaType %} -
    - {{ block( 'settings_maxfilesize' ) }} -
  • - Media player type: - {% if type == 'flash' %} - Flash - {% elseif type == 'quick_time' %} - Quicktime - {% elseif type == 'real_player' %} - Real Player - {% elseif type == 'silverlight' %} - Silverlight - {% elseif type == 'windows_media_player' %} - Window Media Player - {% elseif type == 'html5_video' %} - HTML5 Video - {% elseif type == 'html5_audio' %} - HTML5 Audio - {% else %} - No defined value - {% endif %} -
  • -
-{% endblock %} - -{% block ezimage_settings %} -
    - {{ block( 'settings_maxfilesize' ) }} -
-{% endblock %} - -{% block ezobjectrelation_settings %} -
    -
  • - Selection method: - {% if settings.selectionMethod == 0 %} - Browse - {% elseif settings.selectionMethod == 1 %} - Drop-down list - {% else %} - Drop-down tree - {% endif %} -
  • - {% set rootLocationId = settings.selectionRoot %} - {{ block( 'settings_selectionroot' ) }} -
-{% endblock %} - -{% block ezobjectrelationlist_settings %} -
    -
  • - Selection method: - {% if settings.selectionMethod == 0 %} - Browse - {% elseif settings.selectionMethod == 1 %} - Drop-down list - {% elseif settings.selectionMethod == 2 %} - List with radio buttons - {% elseif settings.selectionMethod == 3 %} - List with checkboxes - {% elseif settings.selectionMethod == 4 %} - Multiple selection list - {% elseif settings.selectionMethod == 5 %} - Template based, multi - {% else %} - Template based, single - {% endif %} -
  • -
  • - Allowed content types: - {% if settings.selectionContentTypes %} - {# TODO display content type name #} -
      - {% for typeIdentifier in settings.selectionContentTypes %} -
    • {{ typeIdentifier }}
    • - {% endfor %} -
    - {% else %} - Any - {% endif %} -
  • - {% set rootLocationId = settings.selectionDefaultLocation %} - {{ block( 'settings_selectionroot' ) }} -
-{% endblock %} - -{% block ezpage_settings %} -
    -
  • - Default layout: - {{ settings.defaultLayout ? settings.defaultLayout : "None" }} -
  • -
-{% endblock %} - - -{% block ezauthor_settings %}{% endblock %} - -{% block ezurl_settings %}{% endblock %} - -{% block ezisbn_settings %} -
    - {% set defaultValue = '' %} - {{ block( 'settings_defaultvalue' ) }} - {% set isISBN13 = settings.isISBN13 %} - {{ block( 'settings_allowisbn13' ) }} -
-{% endblock %} - -{% block ezkeyword_settings %}{% endblock %} - -{% block ezuser_settings %}{% endblock %} - -{% block ezemail_settings %}{% endblock %} - -{% block ezgmaplocation_settings %}{% endblock %} - -{% block ezsrrating_settings %}{% endblock %} - -{% block settings_maxfilesize %} -
  • - Maximum file size: - {% if fielddefinition.validatorConfiguration.FileSizeValidator.maxFileSize %} - {# TODO l10n / unit #} - {{ fielddefinition.validatorConfiguration.FileSizeValidator.maxFileSize }} bytes - {% else %} - No defined maximum size - {% endif %} -
  • -{% endblock %} - -{% block settings_preferredrows %} -
  • - Preferred number of rows: - {% if rows %} - {{ rows }} rows - {% else %} - No preferred number of rows - {% endif %} -
  • -{% endblock %} - -{% block settings_selectionroot %} -
  • - Selection root: - {% if rootLocationId %} - {# TODO: use a dedicated viewType #} - {{ render( controller( "ez_content:viewLocation", {'locationId': rootLocationId, 'viewType': 'line'} ), {'strategy': 'esi'} ) }} - {% else %} - No defined root - {% endif %} -
  • -{% endblock %} - -{% block settings_defaultvalue %} -
  • - Default value: - {% if defaultValue %} - {{ defaultValue }} - {% else %} - No default value - {% endif %} -
  • -{% endblock %} - -{% block settings_minimumvalue %} -
  • - Minimum value: - {% if minValue %} - {{ minValue }} - {% else %} - No defined minimum value - {% endif %} -
  • -{% endblock %} - -{% block settings_maximumvalue %} -
  • - Maximum value: - {% if maxValue %} - {{ maxValue }} - {% else %} - No defined maximum value - {% endif %} -
  • -{% endblock %} - -{% block settings_allowmultiple %} -
  • - Allow multiple choices: - {{ isMultiple ? 'Yes' : 'No' }} -
  • -{% endblock %} - -{% block settings_allowisbn13 %} -
  • - Selected ISBN format: - {{ isISBN13 ? 'ISBN-13' : 'ISBN-10' }} -
  • -{% endblock %} diff --git a/bundle/Templating/Twig/Extension/XmlTextExtension.php b/bundle/Templating/Twig/Extension/XmlTextExtension.php index e9d2a075..ca7fbd36 100644 --- a/bundle/Templating/Twig/Extension/XmlTextExtension.php +++ b/bundle/Templating/Twig/Extension/XmlTextExtension.php @@ -1,14 +1,14 @@ + + + + + + + + + + ./tests/lib/XmlTextAPIIntegrationTest.php + + + + + ./bundle + ./lib + ./vendor + + + diff --git a/phpunit-integration-legacy.xml b/phpunit-integration-legacy.xml new file mode 100644 index 00000000..238e7b92 --- /dev/null +++ b/phpunit-integration-legacy.xml @@ -0,0 +1,27 @@ + + + + + + + + + + ./tests/lib/XmlTextAPIIntegrationTest.php + + + + + ./bundle + ./lib + ./vendor + + + diff --git a/phpunit.xml b/phpunit.xml new file mode 100644 index 00000000..347ed80a --- /dev/null +++ b/phpunit.xml @@ -0,0 +1,26 @@ + + + + + ./tests/bundle/ + ./tests/lib/ + ./tests/lib/XmlTextAPIIntegrationTest.php + ./tests/lib/XmlTextSPIIntegrationTest.php + + + ./tests/lib/XmlTextSPIIntegrationTest.php + + + + + ./bundle + ./lib + ./vendor + + + diff --git a/tests/bootstrap.php b/tests/bootstrap.php new file mode 100644 index 00000000..de59cabd --- /dev/null +++ b/tests/bootstrap.php @@ -0,0 +1,25 @@ +addDefaultSettings( + __DIR__ . '/../../../../../../bundle/Resources/config', + ['default_settings.yml'] ); + + return [ + $extension, + ]; } protected function getMinimalConfiguration() @@ -72,8 +79,8 @@ public function xmlTextSettingsProvider() array( 'fieldtypes.ezxml.custom_xsl' => array( // Default settings will be added - array('path' => '%kernel.root_dir%/../vendor/ezsystems/ezpublish-kernel/eZ/Publish/Core/FieldType/XmlText/Input/Resources/stylesheets/eZXml2Html5_core.xsl', 'priority' => 0), - array('path' => '%kernel.root_dir%/../vendor/ezsystems/ezpublish-kernel/eZ/Publish/Core/FieldType/XmlText/Input/Resources/stylesheets/eZXml2Html5_custom.xsl', 'priority' => 0), + array('path' => '%kernel.root_dir%/../vendor/ezsystems/ezplatform-xmltext-fieldtype/lib/FieldType/XmlText/Input/Resources/stylesheets/eZXml2Html5_core.xsl', 'priority' => 0), + array('path' => '%kernel.root_dir%/../vendor/ezsystems/ezplatform-xmltext-fieldtype/lib/FieldType/XmlText/Input/Resources/stylesheets/eZXml2Html5_custom.xsl', 'priority' => 0), array('path' => '/foo/bar.xsl', 'priority' => 123), array('path' => '/foo/custom.xsl', 'priority' => -10), array('path' => '/another/custom.xsl', 'priority' => 27), diff --git a/tests/bundle/DependencyInjection/Fixtures/ezpublish_minimal.yml b/tests/bundle/DependencyInjection/Fixtures/ezpublish_minimal.yml new file mode 100644 index 00000000..62f84afc --- /dev/null +++ b/tests/bundle/DependencyInjection/Fixtures/ezpublish_minimal.yml @@ -0,0 +1,29 @@ +siteaccess: + default_siteaccess: ezdemo_site + list: + - ezdemo_site + - fre + - ezdemo_site_admin + groups: + ezdemo_group: + - ezdemo_site + - fre + - ezdemo_site_admin + ezdemo_frontend_group: + - ezdemo_site + - fre + match: + URIElement: 1 + Map\URI: + the_front: ezdemo_site + the_back: ezdemo_site_admin + +imagemagick: + enabled: false + +http_cache: + purge_type: local + +router: + default_router: + non_siteaccess_aware_routes: ['foo_route', 'my_prefix_'] diff --git a/tests/lib/FieldType/Converter/EmbedLinkingTest.php b/tests/lib/FieldType/Converter/EmbedLinkingTest.php index a7cbc8f9..dc94c6d8 100644 --- a/tests/lib/FieldType/Converter/EmbedLinkingTest.php +++ b/tests/lib/FieldType/Converter/EmbedLinkingTest.php @@ -1,14 +1,14 @@ file; } - $file = __DIR__ . '/../../../XmlText/Input/Resources/stylesheets/eZXml2Html5_core.xsl'; + $file = __DIR__ . '/../../../../lib/FieldType/XmlText/Input/Resources/stylesheets/eZXml2Html5_core.xsl'; if (!file_exists($file)) { throw new \InvalidArgumentException('Could not find: ' . $file); } diff --git a/tests/lib/FieldType/Gateway/LegacyStorageTest.php b/tests/lib/FieldType/Gateway/LegacyStorageTest.php index f3810aaa..93350284 100644 --- a/tests/lib/FieldType/Gateway/LegacyStorageTest.php +++ b/tests/lib/FieldType/Gateway/LegacyStorageTest.php @@ -1,14 +1,14 @@ load('storage_engines/legacy/external_storage_gateways.yml'); + $loader->load('storage_engines/legacy/field_value_converters.yml'); + $loader->load('fieldtype_external_storages.yml'); + $loader->load('fieldtypes.yml'); + $loader->load('indexable_fieldtypes.yml'); + } +} diff --git a/tests/lib/SetupFactory/LegacySolrSetupFactory.php b/tests/lib/SetupFactory/LegacySolrSetupFactory.php new file mode 100644 index 00000000..77f08256 --- /dev/null +++ b/tests/lib/SetupFactory/LegacySolrSetupFactory.php @@ -0,0 +1,37 @@ +load('storage_engines/legacy/external_storage_gateways.yml'); + $loader->load('storage_engines/legacy/field_value_converters.yml'); + $loader->load('fieldtype_external_storages.yml'); + $loader->load('fieldtypes.yml'); + $loader->load('indexable_fieldtypes.yml'); + } +} diff --git a/tests/lib/XmlTextAPIIntegrationTest.php b/tests/lib/XmlTextAPIIntegrationTest.php index d7403e64..883325a8 100644 --- a/tests/lib/XmlTextAPIIntegrationTest.php +++ b/tests/lib/XmlTextAPIIntegrationTest.php @@ -1,15 +1,16 @@ getContentTypeService(); $locationService = $repository->getLocationService(); - // Create a folder for tests - $createStruct = $contentService->newContentCreateStruct( - $contentTypeService->loadContentTypeByIdentifier('folder'), - 'eng-GB' + // Create test content type + $contentType = $this->createContentType( + $this->getValidFieldSettings(), + $this->getValidValidatorConfiguration() ); + $createStruct = $contentService->newContentCreateStruct($contentType, 'eng-GB'); $createStruct->setField('name', 'Folder Link'); $draft = $contentService->createContent( @@ -567,22 +569,19 @@ public function testConvertRemoteObjectIdToObjectId($test, $expected) array($locationService->newLocationCreateStruct(2)) ); - $folder = $contentService->publishVersion( + $target = $contentService->publishVersion( $draft->versionInfo ); - $object_id = $folder->versionInfo->contentInfo->id; - $node_id = $folder->versionInfo->contentInfo->mainLocationId; - $remote_id = $folder->versionInfo->contentInfo->remoteId; + $object_id = $target->versionInfo->contentInfo->id; + $node_id = $target->versionInfo->contentInfo->mainLocationId; + $remote_id = $target->versionInfo->contentInfo->remoteId; // create value to be tested - $testStruct = $contentService->newContentCreateStruct( - $contentTypeService->loadContentTypeByIdentifier('article'), - 'eng-GB' - ); - $testStruct->setField('title', 'Article - test'); + $testStruct = $contentService->newContentCreateStruct($contentType, 'eng-GB'); + $testStruct->setField('name', 'Article - test'); $testStruct->setField( - 'intro', + 'data', str_replace( '[RemoteId]', $remote_id, @@ -595,14 +594,14 @@ public function testConvertRemoteObjectIdToObjectId($test, $expected) ); $this->assertEquals( - $test->getField('intro')->value->xml->saveXML(), + $test->getField('data')->value->xml->saveXML(), str_replace('[ObjectId]', $object_id, $expected) ); } protected function checkSearchEngineSupport() { - if (ltrim(get_class($this->getSetupFactory()), '\\') === 'eZ\\Publish\\API\\Repository\\Tests\\SetupFactory\\Legacy') { + if (ltrim(get_class($this->getSetupFactory()), '\\') === 'EzSystems\\EzPlatformXmlTextFieldType\\Tests\\SetupFactory\\LegacySetupFactory') { $this->markTestSkipped( "'ezxmltext' field type is not searchable with Legacy Search Engine" ); diff --git a/tests/lib/XmlTextSPIIntegrationTest.php b/tests/lib/XmlTextSPIIntegrationTest.php index dbf5b955..4c87b8b3 100644 --- a/tests/lib/XmlTextSPIIntegrationTest.php +++ b/tests/lib/XmlTextSPIIntegrationTest.php @@ -1,15 +1,16 @@