mirror of
https://github.com/Sylius/Sylius.git
synced 2026-07-14 09:02:12 +00:00
Remove Metadata
This commit is contained in:
parent
fa537441d4
commit
79808b6bde
133 changed files with 0 additions and 7598 deletions
|
|
@ -13,7 +13,6 @@ suites:
|
|||
Inventory: { namespace: Sylius\Component\Inventory, psr4_prefix: Sylius\Component\Inventory, spec_path: src/Sylius/Component/Inventory, src_path: src/Sylius/Component/Inventory }
|
||||
Locale: { namespace: Sylius\Component\Locale, psr4_prefix: Sylius\Component\Locale, spec_path: src/Sylius/Component/Locale, src_path: src/Sylius/Component/Locale }
|
||||
Mailer: { namespace: Sylius\Component\Mailer, psr4_prefix: Sylius\Component\Mailer, spec_path: src/Sylius/Component/Mailer, src_path: src/Sylius/Component/Mailer }
|
||||
Metadata: { namespace: Sylius\Component\Metadata, psr4_prefix: Sylius\Component\Metadata, spec_path: src/Sylius/Component/Metadata, src_path: src/Sylius/Component/Metadata }
|
||||
Order: { namespace: Sylius\Component\Order, psr4_prefix: Sylius\Component\Order, spec_path: src/Sylius/Component/Order, src_path: src/Sylius/Component/Order }
|
||||
Originator: { namespace: Sylius\Component\Originator, psr4_prefix: Sylius\Component\Originator, spec_path: src/Sylius/Component/Originator, src_path: src/Sylius/Component/Originator }
|
||||
Payment: { namespace: Sylius\Component\Payment, psr4_prefix: Sylius\Component\Payment, spec_path: src/Sylius/Component/Payment, src_path: src/Sylius/Component/Payment }
|
||||
|
|
@ -52,7 +51,6 @@ suites:
|
|||
InventoryBundle: { namespace: Sylius\Bundle\InventoryBundle, psr4_prefix: Sylius\Bundle\InventoryBundle, spec_path: src/Sylius/Bundle/InventoryBundle, src_path: src/Sylius/Bundle/InventoryBundle }
|
||||
LocaleBundle: { namespace: Sylius\Bundle\LocaleBundle, psr4_prefix: Sylius\Bundle\LocaleBundle, spec_path: src/Sylius/Bundle/LocaleBundle, src_path: src/Sylius/Bundle/LocaleBundle }
|
||||
MailerBundle: { namespace: Sylius\Bundle\MailerBundle, psr4_prefix: Sylius\Bundle\MailerBundle, spec_path: src/Sylius/Bundle/MailerBundle, src_path: src/Sylius/Bundle/MailerBundle }
|
||||
MetadataBundle: { namespace: Sylius\Bundle\MetadataBundle, psr4_prefix: Sylius\Bundle\MetadataBundle, spec_path: src/Sylius/Bundle/MetadataBundle, src_path: src/Sylius/Bundle/MetadataBundle }
|
||||
MoneyBundle: { namespace: Sylius\Bundle\MoneyBundle, psr4_prefix: Sylius\Bundle\MoneyBundle, spec_path: src/Sylius/Bundle/MoneyBundle, src_path: src/Sylius/Bundle/MoneyBundle }
|
||||
OrderBundle: { namespace: Sylius\Bundle\OrderBundle, psr4_prefix: Sylius\Bundle\OrderBundle, spec_path: src/Sylius/Bundle/OrderBundle, src_path: src/Sylius/Bundle/OrderBundle }
|
||||
PaymentBundle: { namespace: Sylius\Bundle\PaymentBundle, psr4_prefix: Sylius\Bundle\PaymentBundle, spec_path: src/Sylius/Bundle/PaymentBundle, src_path: src/Sylius/Bundle/PaymentBundle }
|
||||
|
|
|
|||
|
|
@ -61,7 +61,6 @@ class Kernel extends HttpKernel
|
|||
new \Sylius\Bundle\UserBundle\SyliusUserBundle(),
|
||||
new \Sylius\Bundle\CustomerBundle\SyliusCustomerBundle(),
|
||||
new \Sylius\Bundle\UiBundle\SyliusUiBundle(),
|
||||
new \Sylius\Bundle\MetadataBundle\SyliusMetadataBundle(),
|
||||
new \Sylius\Bundle\AssociationBundle\SyliusAssociationBundle(),
|
||||
new \Sylius\Bundle\ReviewBundle\SyliusReviewBundle(),
|
||||
new \Sylius\Bundle\CoreBundle\SyliusCoreBundle(),
|
||||
|
|
|
|||
|
|
@ -77,7 +77,6 @@ final class SyliusCoreExtension extends AbstractResourceExtension implements Pre
|
|||
'templating.xml',
|
||||
'reports.xml',
|
||||
'email.xml',
|
||||
'metadata.xml',
|
||||
'sitemap.xml',
|
||||
'dashboard.xml',
|
||||
];
|
||||
|
|
|
|||
|
|
@ -1,41 +0,0 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
|
||||
<!--
|
||||
|
||||
This file is part of the Sylius package.
|
||||
|
||||
(c) Paweł Jędrzejewski
|
||||
|
||||
For the full copyright and license information, please view the LICENSE
|
||||
file that was distributed with this source code.
|
||||
|
||||
-->
|
||||
|
||||
<container xmlns="http://symfony.com/schema/dic/services"
|
||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xsi:schemaLocation="http://symfony.com/schema/dic/services
|
||||
http://symfony.com/schema/dic/services/services-1.0.xsd">
|
||||
|
||||
<parameters>
|
||||
<parameter key="sylius.metadata.hierarchy_provider.product.class">Sylius\Component\Core\Metadata\HierarchyProvider\ProductHierarchyProvider</parameter>
|
||||
<parameter key="sylius.metadata.hierarchy_provider.product_variant.class">Sylius\Component\Core\Metadata\HierarchyProvider\ProductVariantHierarchyProvider</parameter>
|
||||
|
||||
<parameter key="sylius.metadata.provider.core.class">Sylius\Component\Core\Metadata\Provider\MetadataProvider</parameter>
|
||||
</parameters>
|
||||
|
||||
<services>
|
||||
<service id="sylius.metadata.provider.core" class="%sylius.metadata.provider.core.class%" decorates="sylius.metadata.provider" public="false">
|
||||
<argument type="service" id="sylius.metadata.provider.core.inner" />
|
||||
<argument type="service" id="sylius.metadata.hierarchy_provider" />
|
||||
</service>
|
||||
|
||||
<service id="sylius.metadata.hierarchy_provider.product" class="%sylius.metadata.hierarchy_provider.product.class%" public="false">
|
||||
<tag name="sylius.metadata_hierarchy_provider" />
|
||||
</service>
|
||||
|
||||
<service id="sylius.metadata.hierarchy_provider.product_variant" class="%sylius.metadata.hierarchy_provider.product_variant.class%" public="false">
|
||||
<tag name="sylius.metadata_hierarchy_provider" />
|
||||
</service>
|
||||
</services>
|
||||
|
||||
</container>
|
||||
|
|
@ -58,7 +58,6 @@
|
|||
"sylius/variation-bundle": "^1.0",
|
||||
"sylius/association-bundle": "^1.0",
|
||||
"sylius/review-bundle": "^1.0",
|
||||
"sylius/metadata-bundle": "^1.0",
|
||||
"symfony/framework-bundle": "^2.8",
|
||||
"symfony-cmf/routing-bundle": "~1.2",
|
||||
"swiftmailer/swiftmailer": "~5.0",
|
||||
|
|
|
|||
7
src/Sylius/Bundle/MetadataBundle/.gitignore
vendored
7
src/Sylius/Bundle/MetadataBundle/.gitignore
vendored
|
|
@ -1,7 +0,0 @@
|
|||
vendor/
|
||||
bin/
|
||||
|
||||
composer.phar
|
||||
composer.lock
|
||||
|
||||
phpspec.yml
|
||||
|
|
@ -1,37 +0,0 @@
|
|||
<?php
|
||||
|
||||
/*
|
||||
* This file is part of the Sylius package.
|
||||
*
|
||||
* (c) Paweł Jędrzejewski
|
||||
*
|
||||
* For the full copyright and license information, please view the LICENSE
|
||||
* file that was distributed with this source code.
|
||||
*/
|
||||
|
||||
namespace Sylius\Bundle\MetadataBundle\Controller;
|
||||
|
||||
use Sylius\Bundle\ResourceBundle\Controller\ResourceController;
|
||||
use Symfony\Component\HttpFoundation\Request;
|
||||
use Symfony\Component\HttpFoundation\Response;
|
||||
use Symfony\Component\HttpKernel\Exception\NotFoundHttpException;
|
||||
|
||||
/**
|
||||
* @author Kamil Kokot <kamil.kokot@lakion.com>
|
||||
*/
|
||||
class MetadataController extends ResourceController
|
||||
{
|
||||
/**
|
||||
* @param Request $request
|
||||
*
|
||||
* @return Response
|
||||
*/
|
||||
public function customizeAction(Request $request)
|
||||
{
|
||||
try {
|
||||
return $this->updateAction($request);
|
||||
} catch (NotFoundHttpException $exception) {
|
||||
return $this->createAction($request);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -1,101 +0,0 @@
|
|||
<?php
|
||||
|
||||
/*
|
||||
* This file is part of the Sylius package.
|
||||
*
|
||||
* (c) Paweł Jędrzejewski
|
||||
*
|
||||
* For the full copyright and license information, please view the LICENSE
|
||||
* file that was distributed with this source code.
|
||||
*/
|
||||
|
||||
namespace Sylius\Bundle\MetadataBundle\DependencyInjection\Compiler;
|
||||
|
||||
use Symfony\Component\DependencyInjection\Compiler\CompilerPassInterface;
|
||||
use Symfony\Component\DependencyInjection\ContainerBuilder;
|
||||
use Symfony\Component\DependencyInjection\Definition;
|
||||
|
||||
/**
|
||||
* @author Kamil Kokot <kamil.kokot@lakion.com>
|
||||
*/
|
||||
class DynamicFormsChoicesMapCompilerPass implements CompilerPassInterface
|
||||
{
|
||||
/**
|
||||
* @var ContainerBuilder
|
||||
*/
|
||||
private $container;
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function process(ContainerBuilder $container)
|
||||
{
|
||||
$this->container = $container;
|
||||
|
||||
if (!$container->hasDefinition('sylius.metadata.dynamic_forms_choices_map')) {
|
||||
return;
|
||||
}
|
||||
|
||||
$definition = $container->getDefinition('sylius.metadata.dynamic_forms_choices_map');
|
||||
|
||||
$taggedServices = $container->findTaggedServiceIds('sylius.metadata.dynamic_form_choice');
|
||||
|
||||
foreach ($taggedServices as $id => $tags) {
|
||||
$formDefinition = $container->getDefinition($id);
|
||||
|
||||
$dataClass = $this->getFormDataClass($formDefinition);
|
||||
$formName = $this->getFormName($formDefinition);
|
||||
|
||||
$definition->addMethodCall('addForm', [
|
||||
$tags[0]['group'],
|
||||
$dataClass,
|
||||
$formName,
|
||||
isset($tags[0]['label']) ? $tags[0]['label'] : $formName,
|
||||
]);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @param Definition $formDefinition
|
||||
*
|
||||
* @return string Form data class
|
||||
*/
|
||||
private function getFormDataClass(Definition $formDefinition)
|
||||
{
|
||||
$tags = $formDefinition->getTag('sylius.metadata.dynamic_form_choice');
|
||||
$class = isset($tags[0]['class']) ? $tags[0]['class'] : null;
|
||||
|
||||
if (null === $class) {
|
||||
throw new \InvalidArgumentException(sprintf(
|
||||
'Definition "%s" tagged by "%s" should define class attribute in tag definition',
|
||||
$formDefinition->getClass(),
|
||||
'sylius.metadata.dynamic_form'
|
||||
));
|
||||
}
|
||||
|
||||
return $class;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param Definition $formDefinition
|
||||
*
|
||||
* @return string Form name
|
||||
*/
|
||||
private function getFormName(Definition $formDefinition)
|
||||
{
|
||||
$tags = $formDefinition->getTag('form.type');
|
||||
$formName = isset($tags[0]['alias']) ? $tags[0]['alias'] : null;
|
||||
|
||||
if (null === $formName) {
|
||||
throw new \InvalidArgumentException(sprintf(
|
||||
'Definition "%s" tagged by "%s" should also be tagged by "%s" with attribute "%s"',
|
||||
$formDefinition->getClass(),
|
||||
'sylius.metadata.dynamic_form',
|
||||
'form.type',
|
||||
'alias'
|
||||
));
|
||||
}
|
||||
|
||||
return $formName;
|
||||
}
|
||||
}
|
||||
|
|
@ -1,43 +0,0 @@
|
|||
<?php
|
||||
|
||||
/*
|
||||
* This file is part of the Sylius package.
|
||||
*
|
||||
* (c) Paweł Jędrzejewski
|
||||
*
|
||||
* For the full copyright and license information, please view the LICENSE
|
||||
* file that was distributed with this source code.
|
||||
*/
|
||||
|
||||
namespace Sylius\Bundle\MetadataBundle\DependencyInjection\Compiler;
|
||||
|
||||
use Symfony\Component\DependencyInjection\Compiler\CompilerPassInterface;
|
||||
use Symfony\Component\DependencyInjection\ContainerBuilder;
|
||||
use Symfony\Component\DependencyInjection\Reference;
|
||||
|
||||
/**
|
||||
* @author Kamil Kokot <kamil.kokot@lakion.com>
|
||||
*/
|
||||
class MetadataHierarchyProviderCompilerPass implements CompilerPassInterface
|
||||
{
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function process(ContainerBuilder $container)
|
||||
{
|
||||
if (!$container->hasDefinition('sylius.metadata.hierarchy_provider')) {
|
||||
return;
|
||||
}
|
||||
|
||||
$definition = $container->getDefinition('sylius.metadata.hierarchy_provider');
|
||||
|
||||
$taggedServices = $container->findTaggedServiceIds('sylius.metadata_hierarchy_provider');
|
||||
|
||||
$hierarchyProviders = $definition->getArgument(0) ?: [];
|
||||
foreach ($taggedServices as $id => $tags) {
|
||||
$hierarchyProviders[] = new Reference($id);
|
||||
}
|
||||
|
||||
$definition->replaceArgument(0, $hierarchyProviders);
|
||||
}
|
||||
}
|
||||
|
|
@ -1,43 +0,0 @@
|
|||
<?php
|
||||
|
||||
/*
|
||||
* This file is part of the Sylius package.
|
||||
*
|
||||
* (c) Paweł Jędrzejewski
|
||||
*
|
||||
* For the full copyright and license information, please view the LICENSE
|
||||
* file that was distributed with this source code.
|
||||
*/
|
||||
|
||||
namespace Sylius\Bundle\MetadataBundle\DependencyInjection\Compiler;
|
||||
|
||||
use Symfony\Component\DependencyInjection\Compiler\CompilerPassInterface;
|
||||
use Symfony\Component\DependencyInjection\ContainerBuilder;
|
||||
use Symfony\Component\DependencyInjection\Reference;
|
||||
|
||||
/**
|
||||
* @author Kamil Kokot <kamil.kokot@lakion.com>
|
||||
*/
|
||||
class MetadataRendererCompilerPass implements CompilerPassInterface
|
||||
{
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function process(ContainerBuilder $container)
|
||||
{
|
||||
if (!$container->hasDefinition('sylius.metadata.renderer')) {
|
||||
return;
|
||||
}
|
||||
|
||||
$definition = $container->getDefinition('sylius.metadata.renderer');
|
||||
|
||||
$taggedServices = $container->findTaggedServiceIds('sylius.metadata_renderer');
|
||||
|
||||
$renderers = [];
|
||||
foreach ($taggedServices as $id => $tags) {
|
||||
$renderers[] = new Reference($id);
|
||||
}
|
||||
|
||||
$definition->setArguments([$renderers]);
|
||||
}
|
||||
}
|
||||
|
|
@ -1,100 +0,0 @@
|
|||
<?php
|
||||
|
||||
/*
|
||||
* This file is part of the Sylius package.
|
||||
*
|
||||
* (c) Paweł Jędrzejewski
|
||||
*
|
||||
* For the full copyright and license information, please view the LICENSE
|
||||
* file that was distributed with this source code.
|
||||
*/
|
||||
|
||||
namespace Sylius\Bundle\MetadataBundle\DependencyInjection;
|
||||
|
||||
use Sylius\Bundle\MetadataBundle\Controller\MetadataController;
|
||||
use Sylius\Bundle\MetadataBundle\Model\MetadataContainer;
|
||||
use Sylius\Bundle\MetadataBundle\Form\Type\MetadataContainerType;
|
||||
use Sylius\Bundle\ResourceBundle\SyliusResourceBundle;
|
||||
use Sylius\Component\Metadata\Factory\MetadataContainerFactory;
|
||||
use Sylius\Component\Metadata\Model\MetadataContainerInterface;
|
||||
use Symfony\Component\Config\Definition\Builder\ArrayNodeDefinition;
|
||||
use Symfony\Component\Config\Definition\Builder\TreeBuilder;
|
||||
use Symfony\Component\Config\Definition\ConfigurationInterface;
|
||||
|
||||
/**
|
||||
* This class contains the configuration information for the bundle.
|
||||
*
|
||||
* This information is solely responsible for how the different configuration
|
||||
* sections are normalized, and merged.
|
||||
*
|
||||
* @author Kamil Kokot <kamil.kokot@lakion.com>
|
||||
*/
|
||||
class Configuration implements ConfigurationInterface
|
||||
{
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function getConfigTreeBuilder()
|
||||
{
|
||||
$treeBuilder = new TreeBuilder();
|
||||
$rootNode = $treeBuilder->root('sylius_metadata');
|
||||
|
||||
$rootNode
|
||||
->children()
|
||||
->scalarNode('driver')->defaultValue(SyliusResourceBundle::DRIVER_DOCTRINE_ORM)->end()
|
||||
->end()
|
||||
;
|
||||
|
||||
$this->addResourcesSection($rootNode);
|
||||
|
||||
return $treeBuilder;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param ArrayNodeDefinition $node
|
||||
*/
|
||||
private function addResourcesSection(ArrayNodeDefinition $node)
|
||||
{
|
||||
$resourcesBuilder = $node
|
||||
->fixXmlConfig('resource')
|
||||
->children()
|
||||
->arrayNode('resources')
|
||||
->addDefaultsIfNotSet()
|
||||
->children()
|
||||
;
|
||||
|
||||
$resourcesBuilder
|
||||
->arrayNode('metadata_container')
|
||||
->addDefaultsIfNotSet()
|
||||
->children()
|
||||
->variableNode('options')->end()
|
||||
->arrayNode('classes')
|
||||
->addDefaultsIfNotSet()
|
||||
->children()
|
||||
->scalarNode('model')->defaultValue(MetadataContainer::class)->cannotBeEmpty()->end()
|
||||
->scalarNode('interface')->defaultValue(MetadataContainerInterface::class)->cannotBeEmpty()->end()
|
||||
->scalarNode('controller')->defaultValue(MetadataController::class)->cannotBeEmpty()->end()
|
||||
->scalarNode('repository')->cannotBeEmpty()->end()
|
||||
->scalarNode('factory')->defaultValue(MetadataContainerFactory::class)->end()
|
||||
->arrayNode('form')
|
||||
->addDefaultsIfNotSet()
|
||||
->children()
|
||||
->scalarNode('default')->defaultValue(MetadataContainerType::class)->cannotBeEmpty()->end()
|
||||
->end()
|
||||
->end()
|
||||
->end()
|
||||
->end()
|
||||
->arrayNode('validation_groups')
|
||||
->addDefaultsIfNotSet()
|
||||
->children()
|
||||
->arrayNode('default')
|
||||
->prototype('scalar')->end()
|
||||
->defaultValue(['sylius'])
|
||||
->end()
|
||||
->end()
|
||||
->end()
|
||||
->end()
|
||||
->end()
|
||||
;
|
||||
}
|
||||
}
|
||||
|
|
@ -1,89 +0,0 @@
|
|||
<?php
|
||||
|
||||
/*
|
||||
* This file is part of the Sylius package.
|
||||
*
|
||||
* (c) Paweł Jędrzejewski
|
||||
*
|
||||
* For the full copyright and license information, please view the LICENSE
|
||||
* file that was distributed with this source code.
|
||||
*/
|
||||
|
||||
namespace Sylius\Bundle\MetadataBundle\DependencyInjection;
|
||||
|
||||
use Sylius\Bundle\ResourceBundle\DependencyInjection\Extension\AbstractResourceExtension;
|
||||
use Symfony\Component\Config\FileLocator;
|
||||
use Symfony\Component\DependencyInjection\ContainerBuilder;
|
||||
use Symfony\Component\DependencyInjection\Extension\PrependExtensionInterface;
|
||||
use Symfony\Component\DependencyInjection\Loader\XmlFileLoader;
|
||||
use Symfony\Component\DependencyInjection\Reference;
|
||||
|
||||
/**
|
||||
* @author Kamil Kokot <kamil.kokot@lakion.com>
|
||||
*/
|
||||
class SyliusMetadataExtension extends AbstractResourceExtension implements PrependExtensionInterface
|
||||
{
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function load(array $config, ContainerBuilder $container)
|
||||
{
|
||||
$config = $this->processConfiguration($this->getConfiguration($config, $container), $config);
|
||||
$loader = new XmlFileLoader($container, new FileLocator(__DIR__.'/../Resources/config'));
|
||||
|
||||
$this->registerResources('sylius', $config['driver'], $config['resources'], $container);
|
||||
|
||||
$loader->load('services.xml');
|
||||
$loader->load('forms.xml');
|
||||
|
||||
$container
|
||||
->getDefinition('sylius.form.type.page_metadata')
|
||||
->addArgument(new Reference('sylius.metadata.dynamic_form_choice_builder'))
|
||||
;
|
||||
|
||||
$this->addDynamicChoiceTagToForm($container, 'twitter', 'twitter_summary_card');
|
||||
$this->addDynamicChoiceTagToForm($container, 'twitter', 'twitter_summary_large_image_card');
|
||||
$this->addDynamicChoiceTagToForm($container, 'twitter', 'twitter_player_card');
|
||||
$this->addDynamicChoiceTagToForm($container, 'twitter', 'twitter_app_card');
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function prepend(ContainerBuilder $container)
|
||||
{
|
||||
if (!$container->hasExtension('twig')) {
|
||||
return;
|
||||
}
|
||||
|
||||
$container->prependExtensionConfig('twig', [
|
||||
'form_themes' => [
|
||||
'SyliusMetadataBundle:Form:dynamic_form_theme.html.twig',
|
||||
],
|
||||
]);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param ContainerBuilder $container
|
||||
* @param string $group
|
||||
* @param string $formName
|
||||
*/
|
||||
private function addDynamicChoiceTagToForm(ContainerBuilder $container, $group, $formName)
|
||||
{
|
||||
$serviceName = 'sylius.form.type.'.$formName;
|
||||
|
||||
if (!$container->hasDefinition($serviceName)) {
|
||||
throw new \InvalidArgumentException(sprintf(
|
||||
'Service "%s" was not found!',
|
||||
$serviceName
|
||||
));
|
||||
}
|
||||
|
||||
$formDefinition = $container->getDefinition($serviceName);
|
||||
$formDefinition->addTag('sylius.metadata.dynamic_form_choice', [
|
||||
'group' => $group,
|
||||
'label' => 'sylius.metadata.type.'.$formName,
|
||||
'class' => $formDefinition->getArgument(0),
|
||||
]);
|
||||
}
|
||||
}
|
||||
|
|
@ -1,115 +0,0 @@
|
|||
<?php
|
||||
|
||||
/*
|
||||
* This file is part of the Sylius package.
|
||||
*
|
||||
* (c) Paweł Jędrzejewski
|
||||
*
|
||||
* For the full copyright and license information, please view the LICENSE
|
||||
* file that was distributed with this source code.
|
||||
*/
|
||||
|
||||
namespace Sylius\Bundle\MetadataBundle\DynamicForm;
|
||||
|
||||
use Symfony\Component\Form\FormBuilderInterface;
|
||||
use Symfony\Component\Form\FormEvent;
|
||||
use Symfony\Component\Form\FormEvents;
|
||||
use Symfony\Component\Form\FormInterface;
|
||||
use Symfony\Component\PropertyAccess\PropertyAccessorInterface;
|
||||
|
||||
/**
|
||||
* @author Kamil Kokot <kamil.kokot@lakion.com>
|
||||
*/
|
||||
final class DynamicFormBuilder implements DynamicFormBuilderInterface
|
||||
{
|
||||
/**
|
||||
* @var DynamicFormsChoicesMapInterface
|
||||
*/
|
||||
private $dynamicFormsChildrenMap;
|
||||
|
||||
/**
|
||||
* @var PropertyAccessorInterface
|
||||
*/
|
||||
private $propertyAccessor;
|
||||
|
||||
/**
|
||||
* @param DynamicFormsChoicesMapInterface $dynamicFormsChildrenMap
|
||||
* @param PropertyAccessorInterface $propertyAccessor
|
||||
*/
|
||||
public function __construct(DynamicFormsChoicesMapInterface $dynamicFormsChildrenMap, PropertyAccessorInterface $propertyAccessor)
|
||||
{
|
||||
$this->dynamicFormsChildrenMap = $dynamicFormsChildrenMap;
|
||||
$this->propertyAccessor = $propertyAccessor;
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function buildDynamicForm(FormBuilderInterface $builder, $name, $type, array $options = [])
|
||||
{
|
||||
$builder->add($name, $type, $options);
|
||||
|
||||
$this->addModelDataListener($builder, $name, $builder->get($name)->getOption('group'));
|
||||
$this->addSubmittedDataListener($builder, $name);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param FormBuilderInterface $dynamicFormBuilder
|
||||
* @param FormInterface $dynamicForm
|
||||
* @param string $formName
|
||||
*/
|
||||
private function addEmbeddedFormField(FormBuilderInterface $dynamicFormBuilder, FormInterface $dynamicForm, $formName)
|
||||
{
|
||||
$embeddedForm = $dynamicFormBuilder->getFormFactory()->createNamed(
|
||||
$dynamicFormBuilder->getName(),
|
||||
$formName,
|
||||
null,
|
||||
['auto_initialize' => false]
|
||||
);
|
||||
|
||||
$dynamicForm->add($embeddedForm);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param FormBuilderInterface $builder
|
||||
* @param string $name
|
||||
* @param string $group
|
||||
*/
|
||||
private function addModelDataListener(FormBuilderInterface $builder, $name, $group)
|
||||
{
|
||||
$builder->addEventListener(FormEvents::PRE_SET_DATA, function (FormEvent $event) use ($builder, $name, $group) {
|
||||
try {
|
||||
$data = $this->propertyAccessor->getValue($event->getData(), $name);
|
||||
} catch (\RuntimeException $exception) {
|
||||
$data = null;
|
||||
}
|
||||
|
||||
if (null === $data || !is_object($data)) {
|
||||
return;
|
||||
}
|
||||
|
||||
$formName = $this->dynamicFormsChildrenMap->getFormNameByGroupAndDataClass($group, get_class($data));
|
||||
|
||||
$options = $event->getForm()->get($name)->get('_form')->getConfig()->getOptions();
|
||||
$event->getForm()->get($name)->add('_form', 'choice', array_merge($options, ['data' => $formName]));
|
||||
|
||||
$this->addEmbeddedFormField($builder->get($name), $event->getForm()->get($name), $formName);
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* @param FormBuilderInterface $builder
|
||||
* @param string $name
|
||||
*/
|
||||
private function addSubmittedDataListener(FormBuilderInterface $builder, $name)
|
||||
{
|
||||
$builder->get($name)->addEventListener(FormEvents::PRE_SUBMIT, function (FormEvent $event) use ($builder, $name) {
|
||||
$formName = $event->getData()['_form'];
|
||||
if (empty($formName)) {
|
||||
$event->setData([$name => null]);
|
||||
}
|
||||
|
||||
$this->addEmbeddedFormField($builder->get($name), $event->getForm(), $formName ?: 'text');
|
||||
});
|
||||
}
|
||||
}
|
||||
|
|
@ -1,31 +0,0 @@
|
|||
<?php
|
||||
|
||||
/*
|
||||
* This file is part of the Sylius package.
|
||||
*
|
||||
* (c) Paweł Jędrzejewski
|
||||
*
|
||||
* For the full copyright and license information, please view the LICENSE
|
||||
* file that was distributed with this source code.
|
||||
*/
|
||||
|
||||
namespace Sylius\Bundle\MetadataBundle\DynamicForm;
|
||||
|
||||
use Symfony\Component\Form\FormBuilderInterface;
|
||||
|
||||
/**
|
||||
* @author Kamil Kokot <kamil.kokot@lakion.com>
|
||||
*/
|
||||
interface DynamicFormBuilderInterface
|
||||
{
|
||||
/**
|
||||
* Adds dynamic form field to given builder's form, sets up events
|
||||
* and transformers to handle it properly.
|
||||
*
|
||||
* @param FormBuilderInterface $builder
|
||||
* @param string $name
|
||||
* @param string $type
|
||||
* @param array $options
|
||||
*/
|
||||
public function buildDynamicForm(FormBuilderInterface $builder, $name, $type, array $options = []);
|
||||
}
|
||||
|
|
@ -1,85 +0,0 @@
|
|||
<?php
|
||||
|
||||
/*
|
||||
* This file is part of the Sylius package.
|
||||
*
|
||||
* (c) Paweł Jędrzejewski
|
||||
*
|
||||
* For the full copyright and license information, please view the LICENSE
|
||||
* file that was distributed with this source code.
|
||||
*/
|
||||
|
||||
namespace Sylius\Bundle\MetadataBundle\DynamicForm;
|
||||
|
||||
/**
|
||||
* @author Kamil Kokot <kamil.kokot@lakion.com>
|
||||
*/
|
||||
final class DynamicFormsChoicesMap implements DynamicFormsChoicesMapInterface
|
||||
{
|
||||
/**
|
||||
* Maps data class to form name.
|
||||
*
|
||||
* @var string[]
|
||||
*/
|
||||
private $forms;
|
||||
|
||||
/**
|
||||
* Maps form name to label.
|
||||
*
|
||||
* @var string[]
|
||||
*/
|
||||
private $labels;
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function addForm($group, $dataClass, $formName, $label)
|
||||
{
|
||||
$this->forms[$group][$dataClass] = $formName;
|
||||
$this->labels[$formName] = $label;
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function getFormsNamesByGroup($group)
|
||||
{
|
||||
return isset($this->forms[$group]) ? $this->forms[$group] : [];
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function getFormNameByGroupAndDataClass($group, $dataClass)
|
||||
{
|
||||
foreach ($this->getFormsNamesByGroup($group) as $currentDataClass => $formName) {
|
||||
if ($currentDataClass === $dataClass) {
|
||||
return $formName;
|
||||
}
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function getDataClassByGroupAndFormName($group, $formName)
|
||||
{
|
||||
foreach ($this->getFormsNamesByGroup($group) as $dataClass => $currentFormName) {
|
||||
if ($currentFormName === $formName) {
|
||||
return $dataClass;
|
||||
}
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function getLabelByFormName($formName)
|
||||
{
|
||||
return isset($this->labels[$formName]) ? $this->labels[$formName] : $formName;
|
||||
}
|
||||
}
|
||||
|
|
@ -1,56 +0,0 @@
|
|||
<?php
|
||||
|
||||
/*
|
||||
* This file is part of the Sylius package.
|
||||
*
|
||||
* (c) Paweł Jędrzejewski
|
||||
*
|
||||
* For the full copyright and license information, please view the LICENSE
|
||||
* file that was distributed with this source code.
|
||||
*/
|
||||
|
||||
namespace Sylius\Bundle\MetadataBundle\DynamicForm;
|
||||
|
||||
/**
|
||||
* @author Kamil Kokot <kamil.kokot@lakion.com>
|
||||
*/
|
||||
interface DynamicFormsChoicesMapInterface
|
||||
{
|
||||
/**
|
||||
* @param string $group
|
||||
* @param string $dataClass
|
||||
* @param string $formName
|
||||
* @param string $label
|
||||
*/
|
||||
public function addForm($group, $dataClass, $formName, $label);
|
||||
|
||||
/**
|
||||
* @param string $group
|
||||
*
|
||||
* @return string[]
|
||||
*/
|
||||
public function getFormsNamesByGroup($group);
|
||||
|
||||
/**
|
||||
* @param string $group
|
||||
* @param string $dataClass
|
||||
*
|
||||
* @return string|null
|
||||
*/
|
||||
public function getFormNameByGroupAndDataClass($group, $dataClass);
|
||||
|
||||
/**
|
||||
* @param string $group
|
||||
* @param string $formName
|
||||
*
|
||||
* @return string|null
|
||||
*/
|
||||
public function getDataClassByGroupAndFormName($group, $formName);
|
||||
|
||||
/**
|
||||
* @param string $formName
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getLabelByFormName($formName);
|
||||
}
|
||||
|
|
@ -1,130 +0,0 @@
|
|||
<?php
|
||||
|
||||
/*
|
||||
* This file is part of the Sylius package.
|
||||
*
|
||||
* (c) Paweł Jędrzejewski
|
||||
*
|
||||
* For the full copyright and license information, please view the LICENSE
|
||||
* file that was distributed with this source code.
|
||||
*/
|
||||
|
||||
namespace Sylius\Bundle\MetadataBundle\DynamicForm\Type;
|
||||
|
||||
use Sylius\Bundle\MetadataBundle\DynamicForm\DynamicFormsChoicesMapInterface;
|
||||
use Symfony\Component\Form\AbstractType;
|
||||
use Symfony\Component\Form\FormBuilderInterface;
|
||||
use Symfony\Component\Form\FormInterface;
|
||||
use Symfony\Component\Form\FormView;
|
||||
use Symfony\Component\OptionsResolver\OptionsResolver;
|
||||
|
||||
/**
|
||||
* @author Kamil Kokot <kamil.kokot@lakion.com>
|
||||
*/
|
||||
class DynamicFormChoiceType extends AbstractType
|
||||
{
|
||||
/**
|
||||
* @var DynamicFormsChoicesMapInterface
|
||||
*/
|
||||
protected $dynamicFormsChildrenMap;
|
||||
|
||||
/**
|
||||
* @param DynamicFormsChoicesMapInterface $dynamicFormsChildrenMap
|
||||
*/
|
||||
public function __construct(DynamicFormsChoicesMapInterface $dynamicFormsChildrenMap)
|
||||
{
|
||||
$this->dynamicFormsChildrenMap = $dynamicFormsChildrenMap;
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function buildForm(FormBuilderInterface $builder, array $options)
|
||||
{
|
||||
parent::buildForm($builder, $options);
|
||||
|
||||
$availableFormsNames = $this->dynamicFormsChildrenMap->getFormsNamesByGroup($options['group']);
|
||||
|
||||
$this->addAvailableFormsField($builder, $availableFormsNames, $options);
|
||||
$this->addAvailableFormsPrototypes($builder, $availableFormsNames);
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function buildView(FormView $view, FormInterface $form, array $options)
|
||||
{
|
||||
$this->exportAvailableFormsPrototypesToView($view, $form);
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function configureOptions(OptionsResolver $resolver)
|
||||
{
|
||||
parent::configureOptions($resolver);
|
||||
|
||||
$resolver
|
||||
->setDefaults([
|
||||
'inherit_data' => true,
|
||||
'select' => [],
|
||||
])
|
||||
;
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function getName()
|
||||
{
|
||||
return 'sylius_dynamic_form';
|
||||
}
|
||||
|
||||
/**
|
||||
* @param FormBuilderInterface $builder
|
||||
* @param string[] $availableFormsNames
|
||||
*/
|
||||
private function addAvailableFormsField(FormBuilderInterface $builder, $availableFormsNames, array $options)
|
||||
{
|
||||
$choices = [];
|
||||
foreach ($availableFormsNames as $availableFormName) {
|
||||
$choices[$availableFormName] = $this->dynamicFormsChildrenMap->getLabelByFormName($availableFormName);
|
||||
}
|
||||
|
||||
$options = array_merge(
|
||||
['choices' => $choices, 'mapped' => false],
|
||||
$options['select']
|
||||
);
|
||||
|
||||
$builder->add('_form', 'choice', $options);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param FormBuilderInterface $builder
|
||||
* @param string[] $availableFormsNames
|
||||
*/
|
||||
private function addAvailableFormsPrototypes(FormBuilderInterface $builder, $availableFormsNames)
|
||||
{
|
||||
$prototypes = [];
|
||||
foreach ($availableFormsNames as $availableFormName) {
|
||||
$prototypes[$availableFormName] = $builder->create($builder->getName(), $availableFormName)->getForm();
|
||||
}
|
||||
|
||||
$builder->setAttribute('prototypes', $prototypes);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param FormView $view
|
||||
* @param FormInterface $form
|
||||
*/
|
||||
private function exportAvailableFormsPrototypesToView(FormView $view, FormInterface $form)
|
||||
{
|
||||
/** @var FormInterface[] $prototypes */
|
||||
$prototypes = $form->getConfig()->getAttribute('prototypes');
|
||||
|
||||
$view->vars['prototypes'] = [];
|
||||
foreach ($prototypes as $type => $prototype) {
|
||||
$view->vars['prototypes'][$type] = $prototype->createView($view);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -1,94 +0,0 @@
|
|||
<?php
|
||||
|
||||
/*
|
||||
* This file is part of the Sylius package.
|
||||
*
|
||||
* (c) Paweł Jędrzejewski
|
||||
*
|
||||
* For the full copyright and license information, please view the LICENSE
|
||||
* file that was distributed with this source code.
|
||||
*/
|
||||
|
||||
namespace Sylius\Bundle\MetadataBundle\Form\Type\Custom;
|
||||
|
||||
use Sylius\Bundle\MetadataBundle\DynamicForm\DynamicFormBuilderInterface;
|
||||
use Sylius\Bundle\ResourceBundle\Form\Type\AbstractResourceType;
|
||||
use Symfony\Component\Form\CallbackTransformer;
|
||||
use Symfony\Component\Form\FormBuilderInterface;
|
||||
|
||||
/**
|
||||
* @author Kamil Kokot <kamil.kokot@lakion.com>
|
||||
*/
|
||||
class PageMetadataType extends AbstractResourceType
|
||||
{
|
||||
/**
|
||||
* @var DynamicFormBuilderInterface
|
||||
*/
|
||||
private $dynamicFormBuilder;
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*
|
||||
* @var DynamicFormBuilderInterface
|
||||
*/
|
||||
public function __construct($dataClass, array $validationGroups = [], DynamicFormBuilderInterface $dynamicFormBuilder)
|
||||
{
|
||||
parent::__construct($dataClass, $validationGroups);
|
||||
|
||||
$this->dynamicFormBuilder = $dynamicFormBuilder;
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function buildForm(FormBuilderInterface $builder, array $options)
|
||||
{
|
||||
$builder
|
||||
->add('title', 'text', ['label' => 'sylius.metadata.page.title'])
|
||||
->add('description', 'textarea', ['label' => 'sylius.metadata.page.description'])
|
||||
->add('keywords', 'text', ['label' => 'sylius.metadata.page.keywords'])
|
||||
;
|
||||
|
||||
$this->dynamicFormBuilder->buildDynamicForm(
|
||||
$builder,
|
||||
'twitter',
|
||||
'sylius_twitter_card',
|
||||
[
|
||||
'select' => [
|
||||
'label' => 'sylius.metadata.page.twitter',
|
||||
'required' => false,
|
||||
'placeholder' => 'sylius.metadata.type.none',
|
||||
],
|
||||
]
|
||||
);
|
||||
|
||||
$this->addKeywordsTransformer($builder);
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function getName()
|
||||
{
|
||||
return 'sylius_page_metadata';
|
||||
}
|
||||
|
||||
/**
|
||||
* @param FormBuilderInterface $builder
|
||||
*/
|
||||
private function addKeywordsTransformer(FormBuilderInterface $builder)
|
||||
{
|
||||
$builder->get('keywords')->addModelTransformer(new CallbackTransformer(
|
||||
function ($originalKeywords) {
|
||||
if (!is_array($originalKeywords)) {
|
||||
return '';
|
||||
}
|
||||
|
||||
return implode(', ', $originalKeywords);
|
||||
},
|
||||
function ($submittedKeywords) {
|
||||
return array_map('trim', explode(',', $submittedKeywords));
|
||||
}
|
||||
));
|
||||
}
|
||||
}
|
||||
|
|
@ -1,40 +0,0 @@
|
|||
<?php
|
||||
|
||||
/*
|
||||
* This file is part of the Sylius package.
|
||||
*
|
||||
* (c) Paweł Jędrzejewski
|
||||
*
|
||||
* For the full copyright and license information, please view the LICENSE
|
||||
* file that was distributed with this source code.
|
||||
*/
|
||||
|
||||
namespace Sylius\Bundle\MetadataBundle\Form\Type;
|
||||
|
||||
use Sylius\Bundle\ResourceBundle\Form\Type\AbstractResourceType;
|
||||
use Symfony\Component\Form\FormBuilderInterface;
|
||||
|
||||
/**
|
||||
* @author Kamil Kokot <kamil.kokot@lakion.com>
|
||||
*/
|
||||
class MetadataContainerType extends AbstractResourceType
|
||||
{
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function buildForm(FormBuilderInterface $builder, array $options)
|
||||
{
|
||||
$builder
|
||||
->add('id', 'text', ['read_only' => true])
|
||||
->add('metadata', 'sylius_page_metadata')
|
||||
;
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function getName()
|
||||
{
|
||||
return 'sylius_metadata_container';
|
||||
}
|
||||
}
|
||||
|
|
@ -1,50 +0,0 @@
|
|||
<?php
|
||||
|
||||
/*
|
||||
* This file is part of the Sylius package.
|
||||
*
|
||||
* (c) Paweł Jędrzejewski
|
||||
*
|
||||
* For the full copyright and license information, please view the LICENSE
|
||||
* file that was distributed with this source code.
|
||||
*/
|
||||
|
||||
namespace Sylius\Bundle\MetadataBundle\Form\Type\Twitter;
|
||||
|
||||
use Sylius\Bundle\ResourceBundle\Form\Type\AbstractResourceType;
|
||||
use Symfony\Component\Form\FormBuilderInterface;
|
||||
|
||||
/**
|
||||
* @author Kamil Kokot <kamil.kokot@lakion.com>
|
||||
*/
|
||||
class AppCardType extends AbstractResourceType
|
||||
{
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function buildForm(FormBuilderInterface $builder, array $options)
|
||||
{
|
||||
$builder
|
||||
->add('description', 'textarea', ['label' => 'sylius.metadata.twitter.description'])
|
||||
->add('site', 'text', ['label' => 'sylius.metadata.twitter.site'])
|
||||
->add('siteId', 'text', ['label' => 'sylius.metadata.twitter.site_id'])
|
||||
->add('appNameIphone', 'text', ['label' => 'sylius.metadata.twitter.app_name_iphone'])
|
||||
->add('appIdIphone', 'text', ['label' => 'sylius.metadata.twitter.app_id_iphone'])
|
||||
->add('appUrlIphone', 'text', ['label' => 'sylius.metadata.twitter.app_url_iphone'])
|
||||
->add('appNameIpad', 'text', ['label' => 'sylius.metadata.twitter.app_name_ipad'])
|
||||
->add('appIdIpad', 'text', ['label' => 'sylius.metadata.twitter.app_id_ipad'])
|
||||
->add('appUrlIpad', 'text', ['label' => 'sylius.metadata.twitter.app_url_ipad'])
|
||||
->add('appNameGooglePlay', 'text', ['label' => 'sylius.metadata.twitter.app_name_googleplay'])
|
||||
->add('appIdGooglePlay', 'text', ['label' => 'sylius.metadata.twitter.app_id_googleplay'])
|
||||
->add('appUrlGooglePlay', 'text', ['label' => 'sylius.metadata.twitter.app_url_googleplay'])
|
||||
;
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function getName()
|
||||
{
|
||||
return 'sylius_twitter_app_card';
|
||||
}
|
||||
}
|
||||
|
|
@ -1,48 +0,0 @@
|
|||
<?php
|
||||
|
||||
/*
|
||||
* This file is part of the Sylius package.
|
||||
*
|
||||
* (c) Paweł Jędrzejewski
|
||||
*
|
||||
* For the full copyright and license information, please view the LICENSE
|
||||
* file that was distributed with this source code.
|
||||
*/
|
||||
|
||||
namespace Sylius\Bundle\MetadataBundle\Form\Type\Twitter;
|
||||
|
||||
use Sylius\Bundle\ResourceBundle\Form\Type\AbstractResourceType;
|
||||
use Symfony\Component\Form\FormBuilderInterface;
|
||||
|
||||
/**
|
||||
* @author Kamil Kokot <kamil.kokot@lakion.com>
|
||||
*/
|
||||
class PlayerCardType extends AbstractResourceType
|
||||
{
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function buildForm(FormBuilderInterface $builder, array $options)
|
||||
{
|
||||
$builder
|
||||
->add('title', 'text', ['label' => 'sylius.metadata.twitter.title'])
|
||||
->add('description', 'textarea', ['label' => 'sylius.metadata.twitter.description'])
|
||||
->add('image', 'text', ['label' => 'sylius.metadata.twitter.image'])
|
||||
->add('player', 'textarea', ['label' => 'sylius.metadata.twitter.player'])
|
||||
->add('site', 'text', ['label' => 'sylius.metadata.twitter.site'])
|
||||
->add('siteId', 'text', ['label' => 'sylius.metadata.twitter.site_id'])
|
||||
->add('playerWidth', 'number', ['label' => 'sylius.metadata.twitter.player_width'])
|
||||
->add('playerHeight', 'number', ['label' => 'sylius.metadata.twitter.player_height'])
|
||||
->add('playerStream', 'text', ['label' => 'sylius.metadata.twitter.player_stream'])
|
||||
->add('playerStreamContentType', 'text', ['label' => 'sylius.metadata.twitter.player_stream_content_type'])
|
||||
;
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function getName()
|
||||
{
|
||||
return 'sylius_twitter_player_card';
|
||||
}
|
||||
}
|
||||
|
|
@ -1,44 +0,0 @@
|
|||
<?php
|
||||
|
||||
/*
|
||||
* This file is part of the Sylius package.
|
||||
*
|
||||
* (c) Paweł Jędrzejewski
|
||||
*
|
||||
* For the full copyright and license information, please view the LICENSE
|
||||
* file that was distributed with this source code.
|
||||
*/
|
||||
|
||||
namespace Sylius\Bundle\MetadataBundle\Form\Type\Twitter;
|
||||
|
||||
use Sylius\Bundle\ResourceBundle\Form\Type\AbstractResourceType;
|
||||
use Symfony\Component\Form\FormBuilderInterface;
|
||||
|
||||
/**
|
||||
* @author Kamil Kokot <kamil.kokot@lakion.com>
|
||||
*/
|
||||
class SummaryCardType extends AbstractResourceType
|
||||
{
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function buildForm(FormBuilderInterface $builder, array $options)
|
||||
{
|
||||
$builder
|
||||
->add('title', 'text', ['label' => 'sylius.metadata.twitter.title'])
|
||||
->add('description', 'textarea', ['label' => 'sylius.metadata.twitter.description'])
|
||||
->add('image', 'text', ['label' => 'sylius.metadata.twitter.image'])
|
||||
->add('site', 'text', ['label' => 'sylius.metadata.twitter.site'])
|
||||
->add('siteId', 'text', ['label' => 'sylius.metadata.twitter.site_id'])
|
||||
->add('creatorId', 'text', ['label' => 'sylius.metadata.twitter.creator_id'])
|
||||
;
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function getName()
|
||||
{
|
||||
return 'sylius_twitter_summary_card';
|
||||
}
|
||||
}
|
||||
|
|
@ -1,45 +0,0 @@
|
|||
<?php
|
||||
|
||||
/*
|
||||
* This file is part of the Sylius package.
|
||||
*
|
||||
* (c) Paweł Jędrzejewski
|
||||
*
|
||||
* For the full copyright and license information, please view the LICENSE
|
||||
* file that was distributed with this source code.
|
||||
*/
|
||||
|
||||
namespace Sylius\Bundle\MetadataBundle\Form\Type\Twitter;
|
||||
|
||||
use Sylius\Bundle\ResourceBundle\Form\Type\AbstractResourceType;
|
||||
use Symfony\Component\Form\FormBuilderInterface;
|
||||
|
||||
/**
|
||||
* @author Kamil Kokot <kamil.kokot@lakion.com>
|
||||
*/
|
||||
class SummaryLargeImageCardType extends AbstractResourceType
|
||||
{
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function buildForm(FormBuilderInterface $builder, array $options)
|
||||
{
|
||||
$builder
|
||||
->add('title', 'text', ['label' => 'sylius.metadata.twitter.title'])
|
||||
->add('description', 'textarea', ['label' => 'sylius.metadata.twitter.description'])
|
||||
->add('image', 'text', ['label' => 'sylius.metadata.twitter.image'])
|
||||
->add('site', 'text', ['label' => 'sylius.metadata.twitter.site'])
|
||||
->add('siteId', 'text', ['label' => 'sylius.metadata.twitter.site_id'])
|
||||
->add('creator', 'text', ['label' => 'sylius.metadata.twitter.creator'])
|
||||
->add('creatorId', 'text', ['label' => 'sylius.metadata.twitter.creator_id'])
|
||||
;
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function getName()
|
||||
{
|
||||
return 'sylius_twitter_summary_large_image_card';
|
||||
}
|
||||
}
|
||||
|
|
@ -1,55 +0,0 @@
|
|||
<?php
|
||||
|
||||
/*
|
||||
* This file is part of the Sylius package.
|
||||
*
|
||||
* (c) Paweł Jędrzejewski
|
||||
*
|
||||
* For the full copyright and license information, please view the LICENSE
|
||||
* file that was distributed with this source code.
|
||||
*/
|
||||
|
||||
namespace Sylius\Bundle\MetadataBundle\Form\Type\Twitter;
|
||||
|
||||
use Symfony\Component\Form\AbstractType;
|
||||
use Symfony\Component\OptionsResolver\OptionsResolver;
|
||||
|
||||
/**
|
||||
* @author Kamil Kokot <kamil.kokot@lakion.com>
|
||||
*/
|
||||
class TwitterCardType extends AbstractType
|
||||
{
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function configureOptions(OptionsResolver $resolver)
|
||||
{
|
||||
$resolver
|
||||
->setDefaults([
|
||||
'group' => null,
|
||||
])
|
||||
->setNormalizer(
|
||||
'group',
|
||||
function () {
|
||||
return 'twitter';
|
||||
}
|
||||
)
|
||||
;
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function getParent()
|
||||
{
|
||||
return 'sylius_dynamic_form';
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function getName()
|
||||
{
|
||||
return 'sylius_twitter_card';
|
||||
}
|
||||
}
|
||||
|
|
@ -1,47 +0,0 @@
|
|||
<?php
|
||||
|
||||
/*
|
||||
* This file is part of the Sylius package.
|
||||
*
|
||||
* (c) Paweł Jędrzejewski
|
||||
*
|
||||
* For the full copyright and license information, please view the LICENSE
|
||||
* file that was distributed with this source code.
|
||||
*/
|
||||
|
||||
namespace Sylius\Bundle\MetadataBundle\Model;
|
||||
|
||||
use Sylius\Component\Metadata\Model\MetadataContainer as BaseMetadataContainer;
|
||||
use Sylius\Component\Metadata\Model\MetadataInterface;
|
||||
|
||||
/**
|
||||
* @author Kamil Kokot <kamil.kokot@lakion.com>
|
||||
*/
|
||||
class MetadataContainer extends BaseMetadataContainer
|
||||
{
|
||||
/**
|
||||
* @var MetadataInterface
|
||||
*/
|
||||
protected $metadataAsObject;
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function getMetadata()
|
||||
{
|
||||
if (null !== $this->metadataAsObject) {
|
||||
return $this->metadataAsObject;
|
||||
}
|
||||
|
||||
return unserialize($this->metadata) ?: null;
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function setMetadata(MetadataInterface $metadata)
|
||||
{
|
||||
$this->metadataAsObject = $metadata;
|
||||
$this->metadata = serialize($metadata);
|
||||
}
|
||||
}
|
||||
|
|
@ -1,63 +0,0 @@
|
|||
SyliusMetadataBundle [](http://travis-ci.org/Sylius/SyliusMetadataBundle)
|
||||
==================
|
||||
|
||||
[**Symfony2**](http://symfony.com) integration of Sylius Metadata processing component.
|
||||
|
||||
Sylius
|
||||
------
|
||||
|
||||
**Sylius** - Modern ecommerce for Symfony2. Visit [Sylius.org](http://sylius.org).
|
||||
|
||||
[phpspec](http://phpspec.net) examples
|
||||
--------------------------------------
|
||||
|
||||
```bash
|
||||
$ composer install
|
||||
$ bin/phpspec run -f pretty
|
||||
```
|
||||
|
||||
Documentation
|
||||
-------------
|
||||
|
||||
Documentation is available on [**docs.sylius.org**](http://sylius.org/en/latest/bundles/SyliusMetadataBundle/index.html).
|
||||
|
||||
Contributing
|
||||
------------
|
||||
|
||||
All informations about contributing to Sylius can be found on [this page](http://docs.sylius.org/en/latest/contributing/index.html).
|
||||
|
||||
Sylius twitter account
|
||||
----------------------
|
||||
|
||||
If you want to keep up with updates, [follow the official Sylius account on twitter](http://twitter.com/Sylius).
|
||||
|
||||
Bug tracking
|
||||
------------
|
||||
|
||||
This bundle uses [GitHub issues](https://github.com/Sylius/SyliusMetadataBundle/issues).
|
||||
If you have found bug, please create an issue.
|
||||
|
||||
Versioning
|
||||
----------
|
||||
|
||||
Releases will be numbered with the format `major.minor.patch`.
|
||||
|
||||
And constructed with the following guidelines.
|
||||
|
||||
* Breaking backwards compatibility bumps the major.
|
||||
* New additions without breaking backwards compatibility bumps the minor.
|
||||
* Bug fixes and misc changes bump the patch.
|
||||
|
||||
For more information on SemVer, please visit [semver.org website](http://semver.org/)...
|
||||
This versioning method is same for all **Sylius** bundles and applications.
|
||||
|
||||
MIT License
|
||||
-----------
|
||||
|
||||
License can be found [here](https://github.com/Sylius/SyliusMetadataBundle/blob/master/Resources/meta/LICENSE).
|
||||
|
||||
Authors
|
||||
-------
|
||||
|
||||
The bundle was originally created by [Kamil Kokot](http://kamil.kokot.me).
|
||||
See the list of [contributors](https://github.com/Sylius/SyliusMetadataBundle/contributors).
|
||||
|
|
@ -1,20 +0,0 @@
|
|||
<?xml version="1.0" encoding="UTF-8" ?>
|
||||
|
||||
<!--
|
||||
|
||||
This file is part of the Sylius package.
|
||||
|
||||
(c) Paweł Jędrzejewski
|
||||
|
||||
For the full copyright and license information, please view the LICENSE
|
||||
file that was distributed with this source code.
|
||||
|
||||
-->
|
||||
|
||||
<doctrine-mapping xmlns="http://doctrine-project.org/schemas/orm/doctrine-mapping">
|
||||
<mapped-superclass name="Sylius\Bundle\MetadataBundle\Model\MetadataContainer" table="sylius_metadata">
|
||||
<id name="id" column="id" type="string" />
|
||||
|
||||
<field name="metadata" column="metadata" type="text" />
|
||||
</mapped-superclass>
|
||||
</doctrine-mapping>
|
||||
|
|
@ -1,94 +0,0 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
|
||||
<!--
|
||||
|
||||
This file is part of the Sylius package.
|
||||
|
||||
(c) Paweł Jędrzejewski
|
||||
|
||||
For the full copyright and license information, please view the LICENSE
|
||||
file that was distributed with this source code.
|
||||
|
||||
-->
|
||||
|
||||
<container xmlns="http://symfony.com/schema/dic/services"
|
||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xsi:schemaLocation="http://symfony.com/schema/dic/services
|
||||
http://symfony.com/schema/dic/services/services-1.0.xsd">
|
||||
|
||||
<parameters>
|
||||
<parameter key="sylius.metadata.dynamic_form_choice_builder.class">Sylius\Bundle\MetadataBundle\DynamicForm\DynamicFormBuilder</parameter>
|
||||
<parameter key="sylius.metadata.dynamic_forms_choices_map.class">Sylius\Bundle\MetadataBundle\DynamicForm\DynamicFormsChoicesMap</parameter>
|
||||
<parameter key="sylius.metadata.form.type.dynamic_form_choice.class">Sylius\Bundle\MetadataBundle\DynamicForm\Type\DynamicFormChoiceType</parameter>
|
||||
|
||||
<parameter key="sylius.form.type.page_metadata.class">Sylius\Bundle\MetadataBundle\Form\Type\Custom\PageMetadataType</parameter>
|
||||
<parameter key="sylius.form.type.twitter_card.class">Sylius\Bundle\MetadataBundle\Form\Type\Twitter\TwitterCardType</parameter>
|
||||
<parameter key="sylius.form.type.twitter_summary_card.class">Sylius\Bundle\MetadataBundle\Form\Type\Twitter\SummaryCardType</parameter>
|
||||
<parameter key="sylius.form.type.twitter_summary_large_image_card.class">Sylius\Bundle\MetadataBundle\Form\Type\Twitter\SummaryLargeImageCardType</parameter>
|
||||
<parameter key="sylius.form.type.twitter_player_card.class">Sylius\Bundle\MetadataBundle\Form\Type\Twitter\PlayerCardType</parameter>
|
||||
<parameter key="sylius.form.type.twitter_app_card.class">Sylius\Bundle\MetadataBundle\Form\Type\Twitter\AppCardType</parameter>
|
||||
|
||||
<parameter key="sylius.model.page_metadata.class">Sylius\Component\Metadata\Model\Custom\PageMetadata</parameter>
|
||||
<parameter key="sylius.model.twitter_summary_card.class">Sylius\Component\Metadata\Model\Twitter\SummaryCard</parameter>
|
||||
<parameter key="sylius.model.twitter_summary_large_image_card.class">Sylius\Component\Metadata\Model\Twitter\SummaryLargeImageCard</parameter>
|
||||
<parameter key="sylius.model.twitter_player_card.class">Sylius\Component\Metadata\Model\Twitter\PlayerCard</parameter>
|
||||
<parameter key="sylius.model.twitter_app_card.class">Sylius\Component\Metadata\Model\Twitter\AppCard</parameter>
|
||||
|
||||
<parameter key="sylius.validation_groups.page_metadata" type="collection"><parameter>Default</parameter></parameter>
|
||||
<parameter key="sylius.validation_groups.twitter_summary_card" type="collection"><parameter>Default</parameter></parameter>
|
||||
<parameter key="sylius.validation_groups.twitter_summary_large_image_card" type="collection"><parameter>Default</parameter></parameter>
|
||||
<parameter key="sylius.validation_groups.twitter_player_card" type="collection"><parameter>Default</parameter></parameter>
|
||||
<parameter key="sylius.validation_groups.twitter_app_card" type="collection"><parameter>Default</parameter></parameter>
|
||||
</parameters>
|
||||
|
||||
<services>
|
||||
<service id="sylius.metadata.dynamic_form_choice_builder" class="%sylius.metadata.dynamic_form_choice_builder.class%" public="false">
|
||||
<argument type="service" id="sylius.metadata.dynamic_forms_choices_map" />
|
||||
<argument type="service" id="property_accessor" />
|
||||
</service>
|
||||
|
||||
<service id="sylius.metadata.dynamic_forms_choices_map" class="%sylius.metadata.dynamic_forms_choices_map.class%" public="false">
|
||||
<argument type="collection" />
|
||||
</service>
|
||||
|
||||
<service id="sylius.metadata.form.type.dynamic_form_choice" class="%sylius.metadata.form.type.dynamic_form_choice.class%">
|
||||
<argument type="service" id="sylius.metadata.dynamic_forms_choices_map" />
|
||||
<tag name="form.type" alias="sylius_dynamic_form" />
|
||||
</service>
|
||||
|
||||
<service id="sylius.form.type.page_metadata" class="%sylius.form.type.page_metadata.class%">
|
||||
<argument>%sylius.model.page_metadata.class%</argument>
|
||||
<argument>%sylius.validation_groups.page_metadata%</argument>
|
||||
<tag name="form.type" alias="sylius_page_metadata" />
|
||||
</service>
|
||||
|
||||
<service id="sylius.form.type.twitter_card" class="%sylius.form.type.twitter_card.class%">
|
||||
<tag name="form.type" alias="sylius_twitter_card" />
|
||||
</service>
|
||||
|
||||
<service id="sylius.form.type.twitter_summary_card" class="%sylius.form.type.twitter_summary_card.class%">
|
||||
<argument>%sylius.model.twitter_summary_card.class%</argument>
|
||||
<argument>%sylius.validation_groups.twitter_summary_card%</argument>
|
||||
<tag name="form.type" alias="sylius_twitter_summary_card" />
|
||||
</service>
|
||||
|
||||
<service id="sylius.form.type.twitter_summary_large_image_card" class="%sylius.form.type.twitter_summary_large_image_card.class%">
|
||||
<argument>%sylius.model.twitter_summary_large_image_card.class%</argument>
|
||||
<argument>%sylius.validation_groups.twitter_summary_large_image_card%</argument>
|
||||
<tag name="form.type" alias="sylius_twitter_summary_large_image_card" />
|
||||
</service>
|
||||
|
||||
<service id="sylius.form.type.twitter_player_card" class="%sylius.form.type.twitter_player_card.class%">
|
||||
<argument>%sylius.model.twitter_player_card.class%</argument>
|
||||
<argument>%sylius.validation_groups.twitter_player_card%</argument>
|
||||
<tag name="form.type" alias="sylius_twitter_player_card" />
|
||||
</service>
|
||||
|
||||
<service id="sylius.form.type.twitter_app_card" class="%sylius.form.type.twitter_app_card.class%">
|
||||
<argument>%sylius.model.twitter_app_card.class%</argument>
|
||||
<argument>%sylius.validation_groups.twitter_app_card%</argument>
|
||||
<tag name="form.type" alias="sylius_twitter_app_card" />
|
||||
</service>
|
||||
</services>
|
||||
|
||||
</container>
|
||||
|
|
@ -1,88 +0,0 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
|
||||
<!--
|
||||
|
||||
This file is part of the Sylius package.
|
||||
|
||||
(c) Paweł Jędrzejewski
|
||||
|
||||
For the full copyright and license information, please view the LICENSE
|
||||
file that was distributed with this source code.
|
||||
|
||||
-->
|
||||
|
||||
<container xmlns="http://symfony.com/schema/dic/services"
|
||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xsi:schemaLocation="http://symfony.com/schema/dic/services
|
||||
http://symfony.com/schema/dic/services/services-1.0.xsd">
|
||||
|
||||
<parameters>
|
||||
<parameter key="sylius.metadata.compiler.class">Sylius\Component\Metadata\Compiler\MetadataCompiler</parameter>
|
||||
<parameter key="sylius.metadata.processor.class">Sylius\Component\Metadata\Processor\TwigMetadataProcessor</parameter>
|
||||
<parameter key="sylius.metadata.accessor.class">Sylius\Component\Metadata\Accessor\MetadataAccessor</parameter>
|
||||
<parameter key="sylius.metadata.twig_extension.class">Sylius\Component\Metadata\Twig\MetadataExtension</parameter>
|
||||
|
||||
<parameter key="sylius.metadata.renderer.options_resolver.class">Symfony\Component\OptionsResolver\OptionsResolver</parameter>
|
||||
<parameter key="sylius.metadata.renderer.class">Sylius\Component\Metadata\Renderer\CompositeMetadataRenderer</parameter>
|
||||
<parameter key="sylius.metadata.renderer.custom_page.class">Sylius\Component\Metadata\Renderer\Custom\PageMetadataRenderer</parameter>
|
||||
<parameter key="sylius.metadata.renderer.twitter.class">Sylius\Component\Metadata\Renderer\Twitter\GenericTwitterMetadataRenderer</parameter>
|
||||
|
||||
<parameter key="sylius.metadata.provider.class">Sylius\Component\Metadata\Provider\MetadataProvider</parameter>
|
||||
<parameter key="sylius.metadata.provider.processed.class">Sylius\Component\Metadata\Provider\ProcessedMetadataProvider</parameter>
|
||||
|
||||
<parameter key="sylius.metadata.hierarchy_provider.class">Sylius\Component\Metadata\HierarchyProvider\CompositeMetadataHierarchyProvider</parameter>
|
||||
</parameters>
|
||||
|
||||
<services>
|
||||
<service id="sylius.metadata.compiler" class="%sylius.metadata.compiler.class%" public="false" />
|
||||
|
||||
<service id="sylius.metadata.processor" class="%sylius.metadata.processor.class%" public="false">
|
||||
<argument type="service" id="twig" />
|
||||
</service>
|
||||
|
||||
<service id="sylius.metadata.accessor" class="%sylius.metadata.accessor.class%">
|
||||
<argument type="service" id="sylius.metadata.provider" />
|
||||
<argument type="service" id="property_accessor" />
|
||||
</service>
|
||||
|
||||
<service id="sylius.metadata.twig_extension" class="%sylius.metadata.twig_extension.class%" public="false">
|
||||
<argument type="service" id="sylius.metadata.accessor" />
|
||||
<argument type="service" id="sylius.metadata.renderer" />
|
||||
<tag name="twig.extension" />
|
||||
</service>
|
||||
|
||||
<service id="sylius.metadata.renderer.options_resolver" class="%sylius.metadata.renderer.options_resolver.class%" scope="prototype" public="false" />
|
||||
|
||||
<service id="sylius.metadata.renderer" class="%sylius.metadata.renderer.class%">
|
||||
<argument type="collection" /> <!-- Metadata renderers array -->
|
||||
</service>
|
||||
|
||||
<service id="sylius.metadata.renderer.custom_page" class="%sylius.metadata.renderer.custom_page.class%" public="false">
|
||||
<argument type="service" id="sylius.metadata.renderer.twitter" />
|
||||
<argument type="service" id="sylius.metadata.renderer.options_resolver" strict="false" />
|
||||
<argument type="service" id="property_accessor" />
|
||||
<tag name="sylius.metadata_renderer" />
|
||||
</service>
|
||||
|
||||
<service id="sylius.metadata.renderer.twitter" class="%sylius.metadata.renderer.twitter.class%" public="false">
|
||||
<argument type="service" id="sylius.metadata.renderer.options_resolver" strict="false" />
|
||||
<tag name="sylius.metadata_renderer" />
|
||||
</service>
|
||||
|
||||
<service id="sylius.metadata.provider" class="%sylius.metadata.provider.class%" public="false">
|
||||
<argument type="service" id="sylius.repository.metadata_container" />
|
||||
<argument type="service" id="sylius.metadata.compiler" />
|
||||
<argument type="service" id="sylius.metadata.hierarchy_provider" />
|
||||
</service>
|
||||
|
||||
<service id="sylius.metadata.provider.processed" class="%sylius.metadata.provider.processed.class%" decorates="sylius.metadata.provider" public="false">
|
||||
<argument type="service" id="sylius.metadata.provider.processed.inner" />
|
||||
<argument type="service" id="sylius.metadata.processor" />
|
||||
</service>
|
||||
|
||||
<service id="sylius.metadata.hierarchy_provider" class="%sylius.metadata.hierarchy_provider.class%">
|
||||
<argument type="collection" /> <!-- Metadata hierarchy provider array -->
|
||||
</service>
|
||||
</services>
|
||||
|
||||
</container>
|
||||
|
|
@ -1,19 +0,0 @@
|
|||
Copyright (c) 2011-2016 Paweł Jędrzejewski
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
in the Software without restriction, including without limitation the rights
|
||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
copies of the Software, and to permit persons to whom the Software is furnished
|
||||
to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in all
|
||||
copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
THE SOFTWARE.
|
||||
|
|
@ -1,64 +0,0 @@
|
|||
(function ($) {
|
||||
'use strict';
|
||||
|
||||
var methods = {
|
||||
init: function(options) {
|
||||
var settings = $.extend({
|
||||
'prototypePrefix': false,
|
||||
'prototypeElementPrefix': '<hr />',
|
||||
'containerSelector': false
|
||||
}, options);
|
||||
|
||||
return this.each(function() {
|
||||
show($(this), false);
|
||||
$(this).change(function() {
|
||||
show($(this), true);
|
||||
});
|
||||
|
||||
function show(element, replace) {
|
||||
var id = element.attr('id');
|
||||
var selectedValue = element.val();
|
||||
var prototypePrefix = id;
|
||||
if (false != settings.prototypePrefix) {
|
||||
prototypePrefix = settings.prototypePrefix;
|
||||
}
|
||||
|
||||
var prototypeElement = $('#' + prototypePrefix + '_' + selectedValue);
|
||||
var container;
|
||||
|
||||
if (settings.containerSelector) {
|
||||
container = $(settings.containerSelector);
|
||||
} else {
|
||||
container = $(element.data('container'));
|
||||
}
|
||||
|
||||
if (!container.length) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (!prototypeElement.length) {
|
||||
container.empty();
|
||||
return;
|
||||
}
|
||||
|
||||
if (replace || !container.html().trim()) {
|
||||
container.html(settings.prototypeElementPrefix + prototypeElement.data('prototype'));
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
};
|
||||
|
||||
$.fn.handlePrototypes = function(method) {
|
||||
if (methods[method]) {
|
||||
return methods[method].apply(this, Array.prototype.slice.call(arguments, 1));
|
||||
} else if (typeof method === 'object' || !method) {
|
||||
return methods.init.apply(this, arguments);
|
||||
} else {
|
||||
$.error( 'Method ' + method + ' does not exist on jQuery.handlePrototypes' );
|
||||
}
|
||||
};
|
||||
|
||||
$('select[data-dynamic-form]').handlePrototypes();
|
||||
})(jQuery);
|
||||
|
||||
|
|
@ -1,12 +0,0 @@
|
|||
# This file is part of the Sylius package.
|
||||
# (c) Paweł Jędrzejewski
|
||||
|
||||
sylius:
|
||||
metadata:
|
||||
page:
|
||||
title: Назва
|
||||
description: Апісанне
|
||||
twitter:
|
||||
title: Назва
|
||||
description: Апісанне
|
||||
image: малюнак
|
||||
|
|
@ -1,12 +0,0 @@
|
|||
# This file is part of the Sylius package.
|
||||
# (c) Paweł Jędrzejewski
|
||||
|
||||
sylius:
|
||||
metadata:
|
||||
page:
|
||||
title: Títol
|
||||
description: Descripció
|
||||
twitter:
|
||||
title: Títol
|
||||
description: Descripció
|
||||
image: Imatge
|
||||
|
|
@ -1,12 +0,0 @@
|
|||
# This file is part of the Sylius package.
|
||||
# (c) Paweł Jędrzejewski
|
||||
|
||||
sylius:
|
||||
metadata:
|
||||
page:
|
||||
title: Název
|
||||
description: Popis
|
||||
twitter:
|
||||
title: Název
|
||||
description: Popis
|
||||
image: Obrázek
|
||||
|
|
@ -1,12 +0,0 @@
|
|||
# This file is part of the Sylius package.
|
||||
# (c) Paweł Jędrzejewski
|
||||
|
||||
sylius:
|
||||
metadata:
|
||||
page:
|
||||
title: Titel
|
||||
description: Beskrivelse
|
||||
twitter:
|
||||
title: Titel
|
||||
description: Beskrivelse
|
||||
image: Billede
|
||||
|
|
@ -1,38 +0,0 @@
|
|||
# This file is part of the Sylius package.
|
||||
# (c) Paweł Jędrzejewski
|
||||
|
||||
sylius:
|
||||
metadata:
|
||||
type:
|
||||
none: ' - KEINE - '
|
||||
twitter_summary_card: Zusammenfassung
|
||||
twitter_summary_large_image_card: Zusammenfassung mit großem Bild
|
||||
twitter_player_card: Player
|
||||
twitter_app_card: Anwendung
|
||||
page:
|
||||
title: Titel
|
||||
description: Beschreibung
|
||||
keywords: Keywords
|
||||
twitter: Twitter-Karte
|
||||
twitter:
|
||||
title: Titel
|
||||
description: Beschreibung
|
||||
site: Webseite
|
||||
site_id: Website-ID
|
||||
creator: Verfasser
|
||||
creator_id: Verfasser-ID
|
||||
image: Foto
|
||||
player: Player
|
||||
player_width: Playerbreite
|
||||
player_height: Playerhöhe
|
||||
player_stream: Player-stream
|
||||
player_stream_content_type: Player-Stream-Content-type
|
||||
app_name_iphone: Name der iPhone-Anwendung
|
||||
app_id_iphone: iPhone Anwendungs ID
|
||||
app_url_iphone: iPhone Anwendung URL
|
||||
app_name_ipad: iPad Anwendungsname
|
||||
app_id_ipad: iPad Anwendungs ID
|
||||
app_url_ipad: iPad Anwendungs URL
|
||||
app_name_googleplay: Google Play Anwendungsname
|
||||
app_id_googleplay: Google Play Anwendungs ID
|
||||
app_url_googleplay: Google Play Anwendungs URL
|
||||
|
|
@ -1,10 +0,0 @@
|
|||
# This file is part of the Sylius package.
|
||||
# (c) Paweł Jędrzejewski
|
||||
|
||||
sylius:
|
||||
metadata:
|
||||
page:
|
||||
title: Titel
|
||||
twitter:
|
||||
title: Titel
|
||||
image: Bild
|
||||
|
|
@ -1,12 +0,0 @@
|
|||
# This file is part of the Sylius package.
|
||||
# (c) Paweł Jędrzejewski
|
||||
|
||||
sylius:
|
||||
metadata:
|
||||
page:
|
||||
title: Τίτλος
|
||||
description: Περιγραφή
|
||||
twitter:
|
||||
title: Τίτλος
|
||||
description: Περιγραφή
|
||||
image: Εικόνα
|
||||
|
|
@ -1,35 +0,0 @@
|
|||
sylius:
|
||||
metadata:
|
||||
type:
|
||||
none: " - NONE - "
|
||||
twitter_summary_card: Summary
|
||||
twitter_summary_large_image_card: Summary with large image
|
||||
twitter_player_card: Player
|
||||
twitter_app_card: Application
|
||||
page:
|
||||
title: Title
|
||||
description: Description
|
||||
keywords: Keywords
|
||||
twitter: Twitter Card
|
||||
twitter:
|
||||
title: Title
|
||||
description: Description
|
||||
site: Site
|
||||
site_id: Site ID
|
||||
creator: Creator
|
||||
creator_id: Creator ID
|
||||
image: Image
|
||||
player: Player
|
||||
player_width: Player width
|
||||
player_height: Player height
|
||||
player_stream: Player stream
|
||||
player_stream_content_type: Player stream content type
|
||||
app_name_iphone: Iphone application name
|
||||
app_id_iphone: Iphone application ID
|
||||
app_url_iphone: Iphone application url
|
||||
app_name_ipad: Ipad application name
|
||||
app_id_ipad: Ipad application ID
|
||||
app_url_ipad: Ipad application url
|
||||
app_name_googleplay: Google Play application name
|
||||
app_id_googleplay: Google Play application ID
|
||||
app_url_googleplay: Google Play application url
|
||||
|
|
@ -1,38 +0,0 @@
|
|||
# This file is part of the Sylius package.
|
||||
# (c) Paweł Jędrzejewski
|
||||
|
||||
sylius:
|
||||
metadata:
|
||||
type:
|
||||
none: ' - NINGUNO - '
|
||||
twitter_summary_card: Resumen
|
||||
twitter_summary_large_image_card: Resumen con imágenes grandes
|
||||
twitter_player_card: Reproductor
|
||||
twitter_app_card: Aplicación
|
||||
page:
|
||||
title: Título
|
||||
description: Descripción
|
||||
keywords: Palabras clave
|
||||
twitter: Twitter Card
|
||||
twitter:
|
||||
title: Título
|
||||
description: Descripción
|
||||
site: Sitio
|
||||
site_id: Identificador del sitio
|
||||
creator: Creador
|
||||
creator_id: Identificación del creador
|
||||
image: Imagen
|
||||
player: Reproductor
|
||||
player_width: Anchura del reproductor
|
||||
player_height: Altura del reproductor
|
||||
player_stream: Flujo del reproductor
|
||||
player_stream_content_type: Tipo de contenido del flujo del reproductor
|
||||
app_name_iphone: Nombre de la aplicación de iPhone
|
||||
app_id_iphone: Identificador de la aplicación de iPhone
|
||||
app_url_iphone: Url de la aplicación de iPhone
|
||||
app_name_ipad: Nombre de la aplicación de iPad
|
||||
app_id_ipad: ID de la aplicación de iPad
|
||||
app_url_ipad: Url de la aplicación de iPad
|
||||
app_name_googleplay: Nombre de la aplicación de Google Play
|
||||
app_id_googleplay: Identificador de la aplicación de Google Play
|
||||
app_url_googleplay: Url de la aplicación de Google Play
|
||||
|
|
@ -1,38 +0,0 @@
|
|||
# This file is part of the Sylius package.
|
||||
# (c) Paweł Jędrzejewski
|
||||
|
||||
sylius:
|
||||
metadata:
|
||||
type:
|
||||
none: ' -هیچ- '
|
||||
twitter_summary_card: خلاصه
|
||||
twitter_summary_large_image_card: خلاصه با تصویر بزرگ
|
||||
twitter_player_card: پخش کننده
|
||||
twitter_app_card: اپلیکیشن
|
||||
page:
|
||||
title: عنوان
|
||||
description: شرح
|
||||
keywords: کلمات کلیدی
|
||||
twitter: کارت توییتر
|
||||
twitter:
|
||||
title: عنوان
|
||||
description: شرح
|
||||
site: آدرس سایت
|
||||
site_id: شناسه سایت
|
||||
creator: سازنده
|
||||
creator_id: شناسه سازنده
|
||||
image: عکس
|
||||
player: پخش کننده
|
||||
player_width: عرض پخش کننده (پیکسل)
|
||||
player_height: طول پخش کننده (پیکسل)
|
||||
player_stream: آدرس محتوای قابل پخش (به عنوان مثال http://localhost/video.mp4)
|
||||
player_stream_content_type: نوع محتوای قابل پخش (به عنوان مثال video/mp4)
|
||||
app_name_iphone: نام اپلیکیشن آیفون
|
||||
app_id_iphone: آی دی اپلیکیشن آیفون
|
||||
app_url_iphone: آدرس اینترنتی اپلیکیشن آیفون
|
||||
app_name_ipad: نام اپلیکیشن آیپد
|
||||
app_id_ipad: آی دی اپلیکیشن آیپد
|
||||
app_url_ipad: آدرس اینترنتی اپلیکیشن آیپد
|
||||
app_name_googleplay: نام اپلیکیشن گوگل پلی
|
||||
app_id_googleplay: آی دی اپلیکیشن گوگل پلی
|
||||
app_url_googleplay: آدرس اینترنتی اپلیکیشن گوگل پلی
|
||||
|
|
@ -1,38 +0,0 @@
|
|||
# This file is part of the Sylius package.
|
||||
# (c) Paweł Jędrzejewski
|
||||
|
||||
sylius:
|
||||
metadata:
|
||||
type:
|
||||
none: ' - AUCUN - '
|
||||
twitter_summary_card: Résumé
|
||||
twitter_summary_large_image_card: Résumé avec grande image
|
||||
twitter_player_card: Lecteur
|
||||
twitter_app_card: Application
|
||||
page:
|
||||
title: Titre
|
||||
description: Description
|
||||
keywords: Mots clés
|
||||
twitter: Twitter Card
|
||||
twitter:
|
||||
title: Titre
|
||||
description: Description
|
||||
site: Site
|
||||
site_id: Identifiant du site
|
||||
creator: Auteur
|
||||
creator_id: "ID de l'auteur"
|
||||
image: Image
|
||||
player: Lecteur
|
||||
player_width: Largeur du lecteur
|
||||
player_height: Hauteur du lecteur
|
||||
player_stream: Flux du lecteur
|
||||
player_stream_content_type: Type de contenu pour le flux du lecteur
|
||||
app_name_iphone: "Le nom de l'application iPhone"
|
||||
app_id_iphone: "L'ID de l'application iPhone"
|
||||
app_url_iphone: "L'url de l'application iPhone"
|
||||
app_name_ipad: "Nom de l'application iPad"
|
||||
app_id_ipad: "ID de l'application iPad"
|
||||
app_url_ipad: "URL de l'application iPad"
|
||||
app_name_googleplay: "Le nom de l'application Google Play"
|
||||
app_id_googleplay: "ID de l'application Google Play"
|
||||
app_url_googleplay: "URL de l'application Google Play"
|
||||
|
|
@ -1,12 +0,0 @@
|
|||
# This file is part of the Sylius package.
|
||||
# (c) Paweł Jędrzejewski
|
||||
|
||||
sylius:
|
||||
metadata:
|
||||
page:
|
||||
title: Naslov
|
||||
description: Opis
|
||||
twitter:
|
||||
title: Naslov
|
||||
description: Opis
|
||||
image: Fotografija
|
||||
|
|
@ -1,38 +0,0 @@
|
|||
# This file is part of the Sylius package.
|
||||
# (c) Paweł Jędrzejewski
|
||||
|
||||
sylius:
|
||||
metadata:
|
||||
type:
|
||||
none: ' -NINCS- '
|
||||
twitter_summary_card: Összefoglaló
|
||||
twitter_summary_large_image_card: Összefoglaló nagy képpel
|
||||
twitter_player_card: Lejátszó
|
||||
twitter_app_card: Alkalmazás
|
||||
page:
|
||||
title: Cím
|
||||
description: Leírás
|
||||
keywords: Kulcsszavak
|
||||
twitter: Twitter kártya
|
||||
twitter:
|
||||
title: Cím
|
||||
description: Leírás
|
||||
site: Honlap
|
||||
site_id: Webhely azonosító
|
||||
creator: Készítő
|
||||
creator_id: Készítő azonosító
|
||||
image: Kép
|
||||
player: Lejátszó
|
||||
player_width: Lejátszó szélessége
|
||||
player_height: Lejátszó magassága
|
||||
player_stream: Lejátszó folyam
|
||||
player_stream_content_type: Lejátszási folyam tartalom típusa
|
||||
app_name_iphone: Iphone alkalmazás neve
|
||||
app_id_iphone: IPhone alkalmazás azonosítója
|
||||
app_url_iphone: Iphone alkalmazás Url-címe
|
||||
app_name_ipad: Ipad alkalmazás neve
|
||||
app_id_ipad: IPad alkalmazás azonosítója
|
||||
app_url_ipad: Ipad alkalmazás Url-címe
|
||||
app_name_googleplay: A Google Play alkalmazás neve
|
||||
app_id_googleplay: A Google Play alkalmazás azonosítója
|
||||
app_url_googleplay: A Google Play alkalmazás Url-címe
|
||||
|
|
@ -1,10 +0,0 @@
|
|||
# This file is part of the Sylius package.
|
||||
# (c) Paweł Jędrzejewski
|
||||
|
||||
sylius:
|
||||
metadata:
|
||||
page:
|
||||
title: Judul
|
||||
twitter:
|
||||
title: Judul
|
||||
image: Gambar
|
||||
|
|
@ -1,38 +0,0 @@
|
|||
# This file is part of the Sylius package.
|
||||
# (c) Paweł Jędrzejewski
|
||||
|
||||
sylius:
|
||||
metadata:
|
||||
type:
|
||||
none: ' -NESSUNO- '
|
||||
twitter_summary_card: Riepilogo
|
||||
twitter_summary_large_image_card: Riepilogo con grande immagine
|
||||
twitter_player_card: Giocatore
|
||||
twitter_app_card: Applicazione
|
||||
page:
|
||||
title: Titolo
|
||||
description: Descrizione
|
||||
keywords: Parole chiavi
|
||||
twitter: Carta di Twitter
|
||||
twitter:
|
||||
title: Titolo
|
||||
description: Descrizione
|
||||
site: Sito
|
||||
site_id: ID del sito
|
||||
creator: Creator
|
||||
creator_id: ID creatore
|
||||
image: Immagine
|
||||
player: Giocatore
|
||||
player_width: Larghezza del giocatore
|
||||
player_height: Altezza del giocatore
|
||||
player_stream: Giocatore corrente
|
||||
player_stream_content_type: Tipo di contenuto del giocatore corrente
|
||||
app_name_iphone: "Nome dell'applicazione iPhone"
|
||||
app_id_iphone: ID applicazione iPhone
|
||||
app_url_iphone: "Url dell'applicazione iPhone"
|
||||
app_name_ipad: "Nome dell'applicazione iPad"
|
||||
app_id_ipad: ID applicazione iPad
|
||||
app_url_ipad: "Url dell'applicazione iPad"
|
||||
app_name_googleplay: "Nome dell'applicazione Google Play"
|
||||
app_id_googleplay: ID applicazione Google Play
|
||||
app_url_googleplay: "Url dell'applicazione Google Play"
|
||||
|
|
@ -1,7 +0,0 @@
|
|||
# This file is part of the Sylius package.
|
||||
# (c) Paweł Jędrzejewski
|
||||
|
||||
sylius:
|
||||
metadata:
|
||||
twitter:
|
||||
image: 画像
|
||||
|
|
@ -1,12 +0,0 @@
|
|||
# This file is part of the Sylius package.
|
||||
# (c) Paweł Jędrzejewski
|
||||
|
||||
sylius:
|
||||
metadata:
|
||||
page:
|
||||
title: Pavadinimas
|
||||
description: Aprašymas
|
||||
twitter:
|
||||
title: Pavadinimas
|
||||
description: Aprašymas
|
||||
image: Paveikslėlis
|
||||
|
|
@ -1,38 +0,0 @@
|
|||
# This file is part of the Sylius package.
|
||||
# (c) Paweł Jędrzejewski
|
||||
|
||||
sylius:
|
||||
metadata:
|
||||
type:
|
||||
none: ' - GEEN - '
|
||||
twitter_summary_card: Samenvatting
|
||||
twitter_summary_large_image_card: Samenvatting met grote afbeelding
|
||||
twitter_player_card: Afspeler
|
||||
twitter_app_card: Toepassing
|
||||
page:
|
||||
title: Titel
|
||||
description: Omschrijving
|
||||
keywords: Trefwoorden
|
||||
twitter: Twitter kaart
|
||||
twitter:
|
||||
title: Titel
|
||||
description: Omschrijving
|
||||
site: Website
|
||||
site_id: Site ID
|
||||
creator: Auteur
|
||||
creator_id: Auteur ID
|
||||
image: Afbeelding
|
||||
player: Speler
|
||||
player_width: Speler breedte
|
||||
player_height: Speler hoogte
|
||||
player_stream: Afspeler stream
|
||||
player_stream_content_type: Afspeler stream inhoudstype
|
||||
app_name_iphone: iPhone toepassing naam
|
||||
app_id_iphone: iPhone toepassing ID
|
||||
app_url_iphone: iPhone toepassing url
|
||||
app_name_ipad: iPad toepassing naam
|
||||
app_id_ipad: iPad toepassing ID
|
||||
app_url_ipad: iPad toepassing url
|
||||
app_name_googleplay: Google Play toepassing naam
|
||||
app_id_googleplay: Google Play toepassing ID
|
||||
app_url_googleplay: Google Play toepassing url
|
||||
|
|
@ -1,12 +0,0 @@
|
|||
# This file is part of the Sylius package.
|
||||
# (c) Paweł Jędrzejewski
|
||||
|
||||
sylius:
|
||||
metadata:
|
||||
page:
|
||||
title: Tittel
|
||||
description: Beskrivelse
|
||||
twitter:
|
||||
title: Tittel
|
||||
description: Beskrivelse
|
||||
image: Bilde
|
||||
|
|
@ -1,36 +0,0 @@
|
|||
# This file is part of the Sylius package.
|
||||
# (c) Paweł Jędrzejewski
|
||||
|
||||
sylius:
|
||||
metadata:
|
||||
type:
|
||||
none: ' - BRAK - '
|
||||
twitter_summary_card: Podsumowanie
|
||||
twitter_summary_large_image_card: Podsumowanie z dużymi zdjęciami
|
||||
twitter_player_card: Odtwarzacz
|
||||
twitter_app_card: Aplikacja
|
||||
page:
|
||||
title: Tytuł
|
||||
description: Opis
|
||||
keywords: Słowa kluczowe
|
||||
twitter: Karta Twitter
|
||||
twitter:
|
||||
title: Tytuł
|
||||
description: Opis
|
||||
site: Strona
|
||||
site_id: Identyfikator strony
|
||||
creator: Autor
|
||||
creator_id: Identyfikator autora
|
||||
image: Zdjęcie
|
||||
player: Odtwarzacz
|
||||
player_width: Szerokość odtwarzacza
|
||||
player_height: Wysokość odtwarzacza
|
||||
app_name_iphone: Nazwa aplikacji iPhone
|
||||
app_id_iphone: Identyfikator aplikacji iPhone
|
||||
app_url_iphone: Adres URL aplikacji iPhone
|
||||
app_name_ipad: Nazwa aplikacji iPad
|
||||
app_id_ipad: Identyfikator aplikacji iPad
|
||||
app_url_ipad: Adres URL aplikacji iPad
|
||||
app_name_googleplay: Nazwa aplikacji Google Play
|
||||
app_id_googleplay: Identyfikator aplikacji Google Play
|
||||
app_url_googleplay: Adres URL aplikacji Google Play
|
||||
|
|
@ -1,11 +0,0 @@
|
|||
# This file is part of the Sylius package.
|
||||
# (c) Paweł Jędrzejewski
|
||||
|
||||
sylius:
|
||||
metadata:
|
||||
type:
|
||||
twitter_summary_card: Sumário
|
||||
page:
|
||||
description: Descrição
|
||||
twitter:
|
||||
description: Descrição
|
||||
|
|
@ -1,38 +0,0 @@
|
|||
# This file is part of the Sylius package.
|
||||
# (c) Paweł Jędrzejewski
|
||||
|
||||
sylius:
|
||||
metadata:
|
||||
type:
|
||||
none: ' -NENHUM- '
|
||||
twitter_summary_card: Resumo
|
||||
twitter_summary_large_image_card: Resumo com imagem grande
|
||||
twitter_player_card: Reprodutor
|
||||
twitter_app_card: Aplicação
|
||||
page:
|
||||
title: Título
|
||||
description: Descrição
|
||||
keywords: Palavras-Chave
|
||||
twitter: Cartão do Twitter
|
||||
twitter:
|
||||
title: Título
|
||||
description: Descrição
|
||||
site: Site
|
||||
site_id: ID do site
|
||||
creator: Autor
|
||||
creator_id: ID do criador
|
||||
image: Imagem
|
||||
player: Reprodutor
|
||||
player_width: Largura do Player
|
||||
player_height: Altura do Player
|
||||
player_stream: Player stream
|
||||
player_stream_content_type: Player stream tipo de conteúdo
|
||||
app_name_iphone: Nome do aplicativo de iPhone
|
||||
app_id_iphone: ID do aplicativo de iPhone
|
||||
app_url_iphone: Url do aplicativo de iPhone
|
||||
app_name_ipad: Nome do aplicativo de iPad
|
||||
app_id_ipad: ID do aplicativo de iPad
|
||||
app_url_ipad: Url do aplicativo de iPad
|
||||
app_name_googleplay: Nome do aplicativo Google Play
|
||||
app_id_googleplay: Id no Google Play
|
||||
app_url_googleplay: Url do Google Play
|
||||
|
|
@ -1,12 +0,0 @@
|
|||
# This file is part of the Sylius package.
|
||||
# (c) Paweł Jędrzejewski
|
||||
|
||||
sylius:
|
||||
metadata:
|
||||
page:
|
||||
title: Titlu
|
||||
description: Descriere
|
||||
twitter:
|
||||
title: Titlu
|
||||
description: Descriere
|
||||
image: Imagine
|
||||
|
|
@ -1,38 +0,0 @@
|
|||
# This file is part of the Sylius package.
|
||||
# (c) Paweł Jędrzejewski
|
||||
|
||||
sylius:
|
||||
metadata:
|
||||
type:
|
||||
none: ' -Ничего не выбрано- '
|
||||
twitter_summary_card: Резюме
|
||||
twitter_summary_large_image_card: Резюме с большим изображением
|
||||
twitter_player_card: Плейер
|
||||
twitter_app_card: Приложение
|
||||
page:
|
||||
title: Название
|
||||
description: Описание
|
||||
keywords: Ключевые слова
|
||||
twitter: Карта Twitter
|
||||
twitter:
|
||||
title: Название
|
||||
description: Описание
|
||||
site: Сайт
|
||||
site_id: ID сайта
|
||||
creator: Создатель
|
||||
creator_id: Идентификатор создателя
|
||||
image: Изображение
|
||||
player: Плейер
|
||||
player_width: Ширина плеера
|
||||
player_height: Высота плейера
|
||||
player_stream: Поток плейера
|
||||
player_stream_content_type: Тип содержимого потока плейера
|
||||
app_name_iphone: Название приложения iPhone
|
||||
app_id_iphone: Идентификатор приложения iPhone
|
||||
app_url_iphone: Url-адрес приложения iPhone
|
||||
app_name_ipad: Название приложения iPad
|
||||
app_id_ipad: Идентификатор приложения iPad
|
||||
app_url_ipad: Url-адрес приложения iPad
|
||||
app_name_googleplay: Название приложения в Google Play
|
||||
app_id_googleplay: Идентификатор приложения в Google Play
|
||||
app_url_googleplay: Url-адрес приложения Google Play
|
||||
|
|
@ -1,38 +0,0 @@
|
|||
# This file is part of the Sylius package.
|
||||
# (c) Paweł Jędrzejewski
|
||||
|
||||
sylius:
|
||||
metadata:
|
||||
type:
|
||||
none: ' -ŽIADNE- '
|
||||
twitter_summary_card: Zhrnutie
|
||||
twitter_summary_large_image_card: Zhrnutie s veľkým obrazom
|
||||
twitter_player_card: Prehrávač
|
||||
twitter_app_card: Aplikácia
|
||||
page:
|
||||
title: Názov
|
||||
description: Popis
|
||||
keywords: Kľúčové slová
|
||||
twitter: Twitter karta
|
||||
twitter:
|
||||
title: Názov
|
||||
description: Popis
|
||||
site: Stránka
|
||||
site_id: ID stánky
|
||||
creator: Autor
|
||||
creator_id: ID autora
|
||||
image: Obrázok
|
||||
player: Prehrávač
|
||||
player_width: Šírka prehrávača
|
||||
player_height: Výška prehrávača
|
||||
player_stream: Stream prehrávača
|
||||
player_stream_content_type: Typ obsahu prehrávača
|
||||
app_name_iphone: Názov iPhone aplikácie
|
||||
app_id_iphone: ID aplikácie iPhone
|
||||
app_url_iphone: URL Adresa aplikácie iPhone
|
||||
app_name_ipad: Názov aplikácie iPad
|
||||
app_id_ipad: ID aplikácie iPad
|
||||
app_url_ipad: URL Adresa aplikácie iPad
|
||||
app_name_googleplay: Názov aplikácie Google Play
|
||||
app_id_googleplay: ID aplikácie Google Play
|
||||
app_url_googleplay: URL address aplikácie Google Play
|
||||
|
|
@ -1,38 +0,0 @@
|
|||
# This file is part of the Sylius package.
|
||||
# (c) Paweł Jędrzejewski
|
||||
|
||||
sylius:
|
||||
metadata:
|
||||
type:
|
||||
none: ' - BREZ - '
|
||||
twitter_summary_card: Povzetek
|
||||
twitter_summary_large_image_card: Povzetek z veliko sliko
|
||||
twitter_player_card: Predvajalnik
|
||||
twitter_app_card: Aplikacija
|
||||
page:
|
||||
title: Naslov
|
||||
description: Opis
|
||||
keywords: Ključne besede
|
||||
twitter: Twitter Card
|
||||
twitter:
|
||||
title: Naslov
|
||||
description: Opis
|
||||
site: Stran
|
||||
site_id: ID strani
|
||||
creator: Ustvaril(a)
|
||||
creator_id: ID ustvarjalca
|
||||
image: Slika
|
||||
player: Predvajalnik
|
||||
player_width: Širina predvajalnika
|
||||
player_height: Višina predvajalnika
|
||||
player_stream: Pretakanje predvajalnika
|
||||
player_stream_content_type: Vrsta pretočne vsebine predvajalnika
|
||||
app_name_iphone: Ime aplikacije za iPhone
|
||||
app_id_iphone: ID aplikacije za iPhone
|
||||
app_url_iphone: URL Iphone aplikacije
|
||||
app_name_ipad: Ime Ipad aplikacije
|
||||
app_id_ipad: ID Ipad aplikacije
|
||||
app_url_ipad: URL Ipad aplikacije
|
||||
app_name_googleplay: Ime aplikacije Google Play
|
||||
app_id_googleplay: ID aplikacije Google Play
|
||||
app_url_googleplay: URL aplikacije Google Play
|
||||
|
|
@ -1,38 +0,0 @@
|
|||
# This file is part of the Sylius package.
|
||||
# (c) Paweł Jędrzejewski
|
||||
|
||||
sylius:
|
||||
metadata:
|
||||
type:
|
||||
none: ' - ASNJE - '
|
||||
twitter_summary_card: Permbledhje
|
||||
twitter_summary_large_image_card: Permbledhje me imazh te gjere
|
||||
twitter_player_card: Lojtar
|
||||
twitter_app_card: Aplikacion
|
||||
page:
|
||||
title: Titulli
|
||||
description: Përshkrimi
|
||||
keywords: Fjalë kyçe
|
||||
twitter: Karta Twitter
|
||||
twitter:
|
||||
title: Titulli
|
||||
description: Përshkrimi
|
||||
site: Faqe interneti
|
||||
site_id: ID i faqes se internetit
|
||||
creator: Krijues
|
||||
creator_id: ID i krijuesit
|
||||
image: Imazhi
|
||||
player: Lojtar
|
||||
player_width: Gjeresia e lojtarit
|
||||
player_height: Lartesia e lojtarit
|
||||
player_stream: Niveli i lojtarit
|
||||
player_stream_content_type: Tipi i permbajtes se nivelit te lojtarit
|
||||
app_name_iphone: Emri i aplikacionit te Iphone
|
||||
app_id_iphone: ID i aplikacionit te Iphone
|
||||
app_url_iphone: Url e aplikacionit te Iphone
|
||||
app_name_ipad: Emri i aplikacionit te Ipad
|
||||
app_id_ipad: ID i aplikacionit te Ipad
|
||||
app_url_ipad: Url e aplikacionit te Ipad
|
||||
app_name_googleplay: Emri i aplikacionit te Google Play
|
||||
app_id_googleplay: ID e aplikacionit te Google Play
|
||||
app_url_googleplay: Url e aplikacionit te Google Play
|
||||
|
|
@ -1,38 +0,0 @@
|
|||
# This file is part of the Sylius package.
|
||||
# (c) Paweł Jędrzejewski
|
||||
|
||||
sylius:
|
||||
metadata:
|
||||
type:
|
||||
none: ' -INGEN- '
|
||||
twitter_summary_card: Sammanfattning
|
||||
twitter_summary_large_image_card: Sammanfattning med stor bild
|
||||
twitter_player_card: Spelare
|
||||
twitter_app_card: Applikation
|
||||
page:
|
||||
title: Titel
|
||||
description: Beskrivning
|
||||
keywords: Nyckelord
|
||||
twitter: Twitter-kort
|
||||
twitter:
|
||||
title: Titel
|
||||
description: Beskrivning
|
||||
site: Sida
|
||||
site_id: Sid-ID
|
||||
creator: Skapare
|
||||
creator_id: Skapare-ID
|
||||
image: Bild
|
||||
player: Spelare
|
||||
player_width: Spelarbredd
|
||||
player_height: Spelarhöjd
|
||||
player_stream: Spelarström
|
||||
player_stream_content_type: Spelarströms innehållstyp
|
||||
app_name_iphone: Iphone applikationsnamn
|
||||
app_id_iphone: Iphone applikations-ID
|
||||
app_url_iphone: Iphone applikationsurl
|
||||
app_name_ipad: Ipad applikationsnamn
|
||||
app_id_ipad: Ipad applikations-ID
|
||||
app_url_ipad: Ipad applikationsurl
|
||||
app_name_googleplay: Google Play applikationsnamn
|
||||
app_id_googleplay: Google Play applikations-ID
|
||||
app_url_googleplay: Google Play applikationsurl
|
||||
|
|
@ -1,38 +0,0 @@
|
|||
# This file is part of the Sylius package.
|
||||
# (c) Paweł Jędrzejewski
|
||||
|
||||
sylius:
|
||||
metadata:
|
||||
type:
|
||||
none: ' -ไม่มี- '
|
||||
twitter_summary_card: สรุป
|
||||
twitter_summary_large_image_card: สรุป ด้วยภาพขนาดใหญ่
|
||||
twitter_player_card: ผู้เล่น
|
||||
twitter_app_card: แอพพลิเคชัน
|
||||
page:
|
||||
title: หัวข้อ
|
||||
description: คำอธิบาย
|
||||
keywords: คำค้น
|
||||
twitter: Twitter Card
|
||||
twitter:
|
||||
title: หัวข้อ
|
||||
description: คำอธิบาย
|
||||
site: ไซต์
|
||||
site_id: ID ของไซต์
|
||||
creator: ผู้สร้าง
|
||||
creator_id: ID ผู้สร้าง
|
||||
image: รูปภาพ
|
||||
player: ผู้เล่น
|
||||
player_width: ความกว้างของเครื่องเล่น
|
||||
player_height: ความสูงเครื่องเล่น
|
||||
player_stream: เล่นสตรีม
|
||||
player_stream_content_type: เล่นสตรีมชนิดที่เป็นเนื้อหา
|
||||
app_name_iphone: ชื่อแอพพลิเคชั่นสำหรับ Iphone
|
||||
app_id_iphone: ID แอพพลิเคชั่นสำหรับ Iphone
|
||||
app_url_iphone: URL แอพพลิเคชันสำหรับ Iphone
|
||||
app_name_ipad: ชื่อแอพพลิเคชั่นสำหรับ Ipad
|
||||
app_id_ipad: ID แอพพลิเคชันสำหรับ Ipad
|
||||
app_url_ipad: URL แอพพลิเคชั่นสำหรับ Ipad
|
||||
app_name_googleplay: ชื่อแอพพลิเคชั่นสำหรับ Google Play
|
||||
app_id_googleplay: ID แอพพลิเคชั่นสำหรับ Google Play
|
||||
app_url_googleplay: URL แอพพลิเคชั่นสำหรับ Google Play
|
||||
|
|
@ -1,12 +0,0 @@
|
|||
# This file is part of the Sylius package.
|
||||
# (c) Paweł Jędrzejewski
|
||||
|
||||
sylius:
|
||||
metadata:
|
||||
page:
|
||||
title: Başlık
|
||||
description: Açıklama
|
||||
twitter:
|
||||
title: Başlık
|
||||
description: Açıklama
|
||||
image: Resim
|
||||
|
|
@ -1,12 +0,0 @@
|
|||
# This file is part of the Sylius package.
|
||||
# (c) Paweł Jędrzejewski
|
||||
|
||||
sylius:
|
||||
metadata:
|
||||
page:
|
||||
title: Назва
|
||||
description: Опис
|
||||
twitter:
|
||||
title: Назва
|
||||
description: Опис
|
||||
image: Зображення
|
||||
|
|
@ -1,10 +0,0 @@
|
|||
# This file is part of the Sylius package.
|
||||
# (c) Paweł Jędrzejewski
|
||||
|
||||
sylius:
|
||||
metadata:
|
||||
page:
|
||||
title: Tiêu đề
|
||||
twitter:
|
||||
title: Tiêu đề
|
||||
image: Hình ảnh
|
||||
|
|
@ -1,38 +0,0 @@
|
|||
# This file is part of the Sylius package.
|
||||
# (c) Paweł Jędrzejewski
|
||||
|
||||
sylius:
|
||||
metadata:
|
||||
type:
|
||||
none: ' -无- '
|
||||
twitter_summary_card: 摘要
|
||||
twitter_summary_large_image_card: 摘要与大图片
|
||||
twitter_player_card: 玩家
|
||||
twitter_app_card: 程序
|
||||
page:
|
||||
title: 标题
|
||||
description: 描述
|
||||
keywords: 关键字
|
||||
twitter: Twiter卡
|
||||
twitter:
|
||||
title: 标题
|
||||
description: 描述
|
||||
site: 网站
|
||||
site_id: 站点ID
|
||||
creator: 创建人
|
||||
creator_id: 创建者 ID
|
||||
image: 图像
|
||||
player: 玩家
|
||||
player_width: 播放器宽度
|
||||
player_height: 播放器高度
|
||||
player_stream: 播放器流媒体
|
||||
player_stream_content_type: 播放器流媒体内容类型
|
||||
app_name_iphone: Iphone 应用程序名称
|
||||
app_id_iphone: Iphone 应用程序 ID
|
||||
app_url_iphone: Iphone 应用程序 url
|
||||
app_name_ipad: Ipad 应用程序名称
|
||||
app_id_ipad: Ipad 应用程序 ID
|
||||
app_url_ipad: Ipad 应用程序 url
|
||||
app_name_googleplay: 谷歌应用市场应用程序名称
|
||||
app_id_googleplay: 谷歌应用市场应用程序 ID
|
||||
app_url_googleplay: 谷歌应用市场应用程序 url
|
||||
|
|
@ -1,15 +0,0 @@
|
|||
{% block sylius_dynamic_form_row %}
|
||||
{{ form_row(form._form, { 'attr': { 'data-dynamic-form': true, 'data-container': "#dynamic-form-" ~ name } }) }}
|
||||
|
||||
{% for prototypeName, prototype in form.vars.prototypes %}
|
||||
<div id="{{ form._form.vars.id }}_{{ prototypeName }}" data-prototype="{{ form_widget(prototype)|e }}">
|
||||
</div>
|
||||
{% endfor %}
|
||||
|
||||
<div id="dynamic-form-{{ name }}">
|
||||
{# Render nested form (if possible) #}
|
||||
{% if attribute(form.children, name) is defined %}
|
||||
{{ form_widget(attribute(form.children, name)) }}
|
||||
{% endif %}
|
||||
</div>
|
||||
{% endblock %}
|
||||
|
|
@ -1,55 +0,0 @@
|
|||
<?php
|
||||
|
||||
/*
|
||||
* This file is part of the Sylius package.
|
||||
*
|
||||
* (c) Paweł Jędrzejewski
|
||||
*
|
||||
* For the full copyright and license information, please view the LICENSE
|
||||
* file that was distributed with this source code.
|
||||
*/
|
||||
|
||||
namespace Sylius\Bundle\MetadataBundle;
|
||||
|
||||
use Sylius\Bundle\MetadataBundle\DependencyInjection\Compiler\DynamicFormsChoicesMapCompilerPass;
|
||||
use Sylius\Bundle\MetadataBundle\DependencyInjection\Compiler\MetadataHierarchyProviderCompilerPass;
|
||||
use Sylius\Bundle\MetadataBundle\DependencyInjection\Compiler\MetadataRendererCompilerPass;
|
||||
use Sylius\Bundle\ResourceBundle\AbstractResourceBundle;
|
||||
use Sylius\Bundle\ResourceBundle\SyliusResourceBundle;
|
||||
use Symfony\Component\DependencyInjection\ContainerBuilder;
|
||||
|
||||
/**
|
||||
* @author Kamil Kokot <kamil.kokot@lakion.com>
|
||||
*/
|
||||
class SyliusMetadataBundle extends AbstractResourceBundle
|
||||
{
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function build(ContainerBuilder $container)
|
||||
{
|
||||
parent::build($container);
|
||||
|
||||
$container->addCompilerPass(new MetadataRendererCompilerPass());
|
||||
$container->addCompilerPass(new MetadataHierarchyProviderCompilerPass());
|
||||
$container->addCompilerPass(new DynamicFormsChoicesMapCompilerPass());
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function getSupportedDrivers()
|
||||
{
|
||||
return [
|
||||
SyliusResourceBundle::DRIVER_DOCTRINE_ORM,
|
||||
];
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
protected function getModelNamespace()
|
||||
{
|
||||
return 'Sylius\Bundle\MetadataBundle\Model';
|
||||
}
|
||||
}
|
||||
|
|
@ -1,49 +0,0 @@
|
|||
{
|
||||
"name": "sylius/metadata-bundle",
|
||||
"type": "symfony-bundle",
|
||||
"description": "Metadata management for Symfony2 projects.",
|
||||
"keywords": ["metadata"],
|
||||
"homepage": "http://sylius.org",
|
||||
"license": "MIT",
|
||||
"authors": [
|
||||
{
|
||||
"name": "Kamil Kokot",
|
||||
"homepage": "http://kamil.kokot.me"
|
||||
},
|
||||
{
|
||||
"name": "Sylius project",
|
||||
"homepage": "http://sylius.org"
|
||||
},
|
||||
{
|
||||
"name": "Community contributions",
|
||||
"homepage": "http://github.com/Sylius/Sylius/contributors"
|
||||
}
|
||||
],
|
||||
"require": {
|
||||
"php": "^5.6|^7.0",
|
||||
|
||||
"sylius/metadata": "^1.0"
|
||||
},
|
||||
"require-dev": {
|
||||
"phpspec/phpspec": "^3.0"
|
||||
},
|
||||
"autoload": {
|
||||
"psr-4": { "Sylius\\Bundle\\MetadataBundle\\": "" }
|
||||
},
|
||||
"autoload-dev": {
|
||||
"psr-4": { "Sylius\\Bundle\\MetadataBundle\\spec\\": "spec/" }
|
||||
},
|
||||
"minimum-stability": "dev",
|
||||
"prefer-stable": true,
|
||||
"repositories": [
|
||||
{
|
||||
"type": "path",
|
||||
"url": "../../*/*"
|
||||
}
|
||||
],
|
||||
"extra": {
|
||||
"branch-alias": {
|
||||
"dev-master": "1.0-dev"
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -1,5 +0,0 @@
|
|||
suites:
|
||||
main:
|
||||
namespace: Sylius\Bundle\MetadataBundle
|
||||
psr4_prefix: Sylius\Bundle\MetadataBundle
|
||||
src_path: .
|
||||
|
|
@ -1,44 +0,0 @@
|
|||
<?php
|
||||
|
||||
/*
|
||||
* This file is part of the Sylius package.
|
||||
*
|
||||
* (c) Paweł Jędrzejewski
|
||||
*
|
||||
* For the full copyright and license information, please view the LICENSE
|
||||
* file that was distributed with this source code.
|
||||
*/
|
||||
|
||||
namespace Sylius\Component\Core\Metadata\HierarchyProvider;
|
||||
|
||||
use Sylius\Component\Core\Model\ProductInterface;
|
||||
use Sylius\Component\Metadata\HierarchyProvider\MetadataHierarchyProviderInterface;
|
||||
use Sylius\Component\Metadata\Model\MetadataSubjectInterface;
|
||||
|
||||
/**
|
||||
* @author Kamil Kokot <kamil.kokot@lakion.com>
|
||||
*/
|
||||
class ProductHierarchyProvider implements MetadataHierarchyProviderInterface
|
||||
{
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function getHierarchyByMetadataSubject(MetadataSubjectInterface $product)
|
||||
{
|
||||
$hierarchy = [
|
||||
$product->getMetadataIdentifier(),
|
||||
$product->getMetadataClassIdentifier(),
|
||||
'DefaultPage',
|
||||
];
|
||||
|
||||
return $hierarchy;
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function supports(MetadataSubjectInterface $metadataSubject)
|
||||
{
|
||||
return $metadataSubject instanceof ProductInterface;
|
||||
}
|
||||
}
|
||||
|
|
@ -1,52 +0,0 @@
|
|||
<?php
|
||||
|
||||
/*
|
||||
* This file is part of the Sylius package.
|
||||
*
|
||||
* (c) Paweł Jędrzejewski
|
||||
*
|
||||
* For the full copyright and license information, please view the LICENSE
|
||||
* file that was distributed with this source code.
|
||||
*/
|
||||
|
||||
namespace Sylius\Component\Core\Metadata\HierarchyProvider;
|
||||
|
||||
use Sylius\Component\Core\Model\ProductInterface;
|
||||
use Sylius\Component\Core\Model\ProductVariantInterface;
|
||||
use Sylius\Component\Metadata\HierarchyProvider\MetadataHierarchyProviderInterface;
|
||||
use Sylius\Component\Metadata\Model\MetadataSubjectInterface;
|
||||
|
||||
/**
|
||||
* @author Kamil Kokot <kamil.kokot@lakion.com>
|
||||
*/
|
||||
class ProductVariantHierarchyProvider implements MetadataHierarchyProviderInterface
|
||||
{
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function getHierarchyByMetadataSubject(MetadataSubjectInterface $metadataSubject)
|
||||
{
|
||||
/** @var ProductVariantInterface $productVariant */
|
||||
$productVariant = $metadataSubject;
|
||||
|
||||
/** @var ProductInterface $product */
|
||||
$product = $productVariant->getProduct();
|
||||
|
||||
$hierarchy = [
|
||||
$productVariant->getMetadataIdentifier(),
|
||||
$product->getMetadataIdentifier(),
|
||||
$product->getMetadataClassIdentifier(),
|
||||
'DefaultPage',
|
||||
];
|
||||
|
||||
return $hierarchy;
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function supports(MetadataSubjectInterface $metadataSubject)
|
||||
{
|
||||
return $metadataSubject instanceof ProductVariantInterface;
|
||||
}
|
||||
}
|
||||
|
|
@ -1,63 +0,0 @@
|
|||
<?php
|
||||
|
||||
/*
|
||||
* This file is part of the Sylius package.
|
||||
*
|
||||
* (c) Paweł Jędrzejewski
|
||||
*
|
||||
* For the full copyright and license information, please view the LICENSE
|
||||
* file that was distributed with this source code.
|
||||
*/
|
||||
|
||||
namespace Sylius\Component\Core\Metadata\Provider;
|
||||
|
||||
use Sylius\Component\Metadata\HierarchyProvider\MetadataHierarchyProviderInterface;
|
||||
use Sylius\Component\Metadata\Model\Custom\PageMetadata;
|
||||
use Sylius\Component\Metadata\Model\MetadataSubjectInterface;
|
||||
use Sylius\Component\Metadata\Provider\MetadataProviderInterface;
|
||||
|
||||
/**
|
||||
* @author Kamil Kokot <kamil.kokot@lakion.com>
|
||||
*/
|
||||
class MetadataProvider implements MetadataProviderInterface
|
||||
{
|
||||
/**
|
||||
* @var MetadataProviderInterface
|
||||
*/
|
||||
private $metadataProvider;
|
||||
|
||||
/**
|
||||
* @var MetadataHierarchyProviderInterface
|
||||
*/
|
||||
private $metadataHierarchyProvider;
|
||||
|
||||
/**
|
||||
* @param MetadataProviderInterface $metadataProvider
|
||||
* @param MetadataHierarchyProviderInterface $metadataHierarchyProvider
|
||||
*/
|
||||
public function __construct(
|
||||
MetadataProviderInterface $metadataProvider,
|
||||
MetadataHierarchyProviderInterface $metadataHierarchyProvider
|
||||
) {
|
||||
$this->metadataProvider = $metadataProvider;
|
||||
$this->metadataHierarchyProvider = $metadataHierarchyProvider;
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function findMetadataBySubject(MetadataSubjectInterface $metadataSubject)
|
||||
{
|
||||
$metadata = $this->metadataProvider->findMetadataBySubject($metadataSubject);
|
||||
if (null !== $metadata) {
|
||||
return $metadata;
|
||||
}
|
||||
|
||||
$hierarchy = $this->metadataHierarchyProvider->getHierarchyByMetadataSubject($metadataSubject);
|
||||
if ('DefaultPage' === end($hierarchy)) {
|
||||
return new PageMetadata();
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
|
@ -11,10 +11,7 @@
|
|||
|
||||
namespace Sylius\Component\Core\Model;
|
||||
|
||||
use Doctrine\Common\Collections\Collection;
|
||||
use Sylius\Component\Addressing\Model\ZoneInterface;
|
||||
use Sylius\Component\Channel\Model\ChannelsAwareInterface;
|
||||
use Sylius\Component\Metadata\Model\MetadataSubjectInterface;
|
||||
use Sylius\Component\Product\Model\ProductInterface as BaseProductInterface;
|
||||
use Sylius\Component\Review\Model\ReviewableInterface;
|
||||
use Sylius\Component\Shipping\Model\ShippingCategoryInterface;
|
||||
|
|
@ -28,7 +25,6 @@ interface ProductInterface extends
|
|||
BaseProductInterface,
|
||||
TaxonsAwareInterface,
|
||||
ChannelsAwareInterface,
|
||||
MetadataSubjectInterface,
|
||||
ReviewableInterface
|
||||
{
|
||||
/*
|
||||
|
|
|
|||
|
|
@ -13,7 +13,6 @@ namespace Sylius\Component\Core\Model;
|
|||
|
||||
use Doctrine\Common\Collections\Collection;
|
||||
use Sylius\Component\Inventory\Model\StockableInterface;
|
||||
use Sylius\Component\Metadata\Model\MetadataSubjectInterface;
|
||||
use Sylius\Component\Pricing\Model\PriceableInterface;
|
||||
use Sylius\Component\Product\Model\VariantInterface as BaseVariantInterface;
|
||||
use Sylius\Component\Shipping\Model\ShippableInterface;
|
||||
|
|
@ -28,7 +27,6 @@ interface ProductVariantInterface extends
|
|||
ShippableInterface,
|
||||
StockableInterface,
|
||||
PriceableInterface,
|
||||
MetadataSubjectInterface,
|
||||
TaxableInterface
|
||||
{
|
||||
const METADATA_CLASS_IDENTIFIER = 'ProductVariant';
|
||||
|
|
|
|||
|
|
@ -48,7 +48,6 @@
|
|||
"sylius/variation": "^1.0",
|
||||
"sylius/association": "^1.0",
|
||||
"sylius/review": "^1.0",
|
||||
"sylius/metadata": "^1.0",
|
||||
"webmozart/assert": "^1.0",
|
||||
"zendframework/zend-stdlib": "^2.0|^3.0"
|
||||
},
|
||||
|
|
|
|||
|
|
@ -1,56 +0,0 @@
|
|||
<?php
|
||||
|
||||
/*
|
||||
* This file is part of the Sylius package.
|
||||
*
|
||||
* (c) Paweł Jędrzejewski
|
||||
*
|
||||
* For the full copyright and license information, please view the LICENSE
|
||||
* file that was distributed with this source code.
|
||||
*/
|
||||
|
||||
namespace spec\Sylius\Component\Core\Metadata\HierarchyProvider;
|
||||
|
||||
use PhpSpec\ObjectBehavior;
|
||||
use Sylius\Component\Core\Metadata\HierarchyProvider\ProductHierarchyProvider;
|
||||
use Sylius\Component\Core\Model\ProductInterface;
|
||||
use Sylius\Component\Metadata\HierarchyProvider\MetadataHierarchyProviderInterface;
|
||||
use Sylius\Component\Metadata\Model\MetadataSubjectInterface;
|
||||
|
||||
/**
|
||||
* @mixin ProductHierarchyProvider
|
||||
*
|
||||
* @author Kamil Kokot <kamil.kokot@lakion.com>
|
||||
*/
|
||||
final class ProductHierarchyProviderSpec extends ObjectBehavior
|
||||
{
|
||||
function it_is_initializable()
|
||||
{
|
||||
$this->shouldHaveType('Sylius\Component\Core\Metadata\HierarchyProvider\ProductHierarchyProvider');
|
||||
}
|
||||
|
||||
function it_implements_Sylius_Metadata_Hierarchy_Provider_interface()
|
||||
{
|
||||
$this->shouldImplement(MetadataHierarchyProviderInterface::class);
|
||||
}
|
||||
|
||||
function it_supports_Sylius_Core_Product(
|
||||
ProductInterface $coreProduct,
|
||||
MetadataSubjectInterface $metadataSubject
|
||||
) {
|
||||
$this->supports($coreProduct)->shouldReturn(true);
|
||||
$this->supports($metadataSubject)->shouldReturn(false);
|
||||
}
|
||||
|
||||
function it_generates_correct_hierarchy(ProductInterface $product)
|
||||
{
|
||||
$product->getMetadataIdentifier()->shouldBeCalled()->willReturn('Product-42');
|
||||
$product->getMetadataClassIdentifier()->shouldBeCalled()->willReturn('Product');
|
||||
|
||||
$this->getHierarchyByMetadataSubject($product)->shouldReturn([
|
||||
'Product-42',
|
||||
'Product',
|
||||
'DefaultPage',
|
||||
]);
|
||||
}
|
||||
}
|
||||
|
|
@ -1,61 +0,0 @@
|
|||
<?php
|
||||
|
||||
/*
|
||||
* This file is part of the Sylius package.
|
||||
*
|
||||
* (c) Paweł Jędrzejewski
|
||||
*
|
||||
* For the full copyright and license information, please view the LICENSE
|
||||
* file that was distributed with this source code.
|
||||
*/
|
||||
|
||||
namespace spec\Sylius\Component\Core\Metadata\HierarchyProvider;
|
||||
|
||||
use PhpSpec\ObjectBehavior;
|
||||
use Sylius\Component\Core\Metadata\HierarchyProvider\ProductVariantHierarchyProvider;
|
||||
use Sylius\Component\Core\Model\ProductInterface;
|
||||
use Sylius\Component\Core\Model\ProductVariantInterface;
|
||||
use Sylius\Component\Metadata\HierarchyProvider\MetadataHierarchyProviderInterface;
|
||||
use Sylius\Component\Metadata\Model\MetadataSubjectInterface;
|
||||
|
||||
/**
|
||||
* @mixin ProductVariantHierarchyProvider
|
||||
*
|
||||
* @author Kamil Kokot <kamil.kokot@lakion.com>
|
||||
*/
|
||||
final class ProductVariantHierarchyProviderSpec extends ObjectBehavior
|
||||
{
|
||||
function it_is_initializable()
|
||||
{
|
||||
$this->shouldHaveType('Sylius\Component\Core\Metadata\HierarchyProvider\ProductVariantHierarchyProvider');
|
||||
}
|
||||
|
||||
function it_implements_Sylius_Metadata_Hierarchy_Provider_interface()
|
||||
{
|
||||
$this->shouldImplement(MetadataHierarchyProviderInterface::class);
|
||||
}
|
||||
|
||||
function it_supports_Sylius_Core_ProductVariant(
|
||||
ProductVariantInterface $coreProductVariant,
|
||||
MetadataSubjectInterface $metadataSubject
|
||||
) {
|
||||
$this->supports($coreProductVariant)->shouldReturn(true);
|
||||
$this->supports($metadataSubject)->shouldReturn(false);
|
||||
}
|
||||
|
||||
function it_generates_correct_hierarchy(ProductVariantInterface $productVariant, ProductInterface $product) {
|
||||
$productVariant->getMetadataIdentifier()->shouldBeCalled()->willReturn('ProductVariant-42');
|
||||
|
||||
$product->getMetadataIdentifier()->shouldBeCalled()->willReturn('Product-42');
|
||||
$product->getMetadataClassIdentifier()->shouldBeCalled()->willReturn('Product');
|
||||
|
||||
$productVariant->getProduct()->shouldBeCalled()->willReturn($product);
|
||||
|
||||
$this->getHierarchyByMetadataSubject($productVariant)->shouldReturn([
|
||||
'ProductVariant-42',
|
||||
'Product-42',
|
||||
'Product',
|
||||
'DefaultPage',
|
||||
]);
|
||||
}
|
||||
}
|
||||
7
src/Sylius/Component/Metadata/.gitignore
vendored
7
src/Sylius/Component/Metadata/.gitignore
vendored
|
|
@ -1,7 +0,0 @@
|
|||
vendor/
|
||||
bin/
|
||||
|
||||
composer.phar
|
||||
composer.lock
|
||||
|
||||
phpspec.yml
|
||||
|
|
@ -1,56 +0,0 @@
|
|||
<?php
|
||||
|
||||
/*
|
||||
* This file is part of the Sylius package.
|
||||
*
|
||||
* (c) Paweł Jędrzejewski
|
||||
*
|
||||
* For the full copyright and license information, please view the LICENSE
|
||||
* file that was distributed with this source code.
|
||||
*/
|
||||
|
||||
namespace Sylius\Component\Metadata\Accessor;
|
||||
|
||||
use Sylius\Component\Metadata\Model\MetadataSubjectInterface;
|
||||
use Sylius\Component\Metadata\Provider\MetadataProviderInterface;
|
||||
use Symfony\Component\PropertyAccess\PropertyAccessorInterface;
|
||||
|
||||
/**
|
||||
* @author Kamil Kokot <kamil.kokot@lakion.com>
|
||||
*/
|
||||
final class MetadataAccessor implements MetadataAccessorInterface
|
||||
{
|
||||
/**
|
||||
* @var MetadataProviderInterface
|
||||
*/
|
||||
private $metadataProvider;
|
||||
|
||||
/**
|
||||
* @var PropertyAccessorInterface
|
||||
*/
|
||||
private $propertyAccessor;
|
||||
|
||||
/**
|
||||
* @param MetadataProviderInterface $metadataProvider
|
||||
* @param PropertyAccessorInterface $propertyAccessor
|
||||
*/
|
||||
public function __construct(MetadataProviderInterface $metadataProvider, PropertyAccessorInterface $propertyAccessor)
|
||||
{
|
||||
$this->metadataProvider = $metadataProvider;
|
||||
$this->propertyAccessor = $propertyAccessor;
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function getProperty(MetadataSubjectInterface $metadataSubject, $propertyPath = null)
|
||||
{
|
||||
$metadata = $this->metadataProvider->findMetadataBySubject($metadataSubject);
|
||||
|
||||
if (null === $propertyPath) {
|
||||
return $metadata;
|
||||
}
|
||||
|
||||
return $this->propertyAccessor->getValue($metadata, $propertyPath);
|
||||
}
|
||||
}
|
||||
|
|
@ -1,28 +0,0 @@
|
|||
<?php
|
||||
|
||||
/*
|
||||
* This file is part of the Sylius package.
|
||||
*
|
||||
* (c) Paweł Jędrzejewski
|
||||
*
|
||||
* For the full copyright and license information, please view the LICENSE
|
||||
* file that was distributed with this source code.
|
||||
*/
|
||||
|
||||
namespace Sylius\Component\Metadata\Accessor;
|
||||
|
||||
use Sylius\Component\Metadata\Model\MetadataSubjectInterface;
|
||||
|
||||
/**
|
||||
* @author Kamil Kokot <kamil.kokot@lakion.com>
|
||||
*/
|
||||
interface MetadataAccessorInterface
|
||||
{
|
||||
/**
|
||||
* @param MetadataSubjectInterface $metadataSubject
|
||||
* @param string|null $propertyPath
|
||||
*
|
||||
* @return mixed
|
||||
*/
|
||||
public function getProperty(MetadataSubjectInterface $metadataSubject, $propertyPath = null);
|
||||
}
|
||||
|
|
@ -1,35 +0,0 @@
|
|||
<?php
|
||||
|
||||
/*
|
||||
* This file is part of the Sylius package.
|
||||
*
|
||||
* (c) Paweł Jędrzejewski
|
||||
*
|
||||
* For the full copyright and license information, please view the LICENSE
|
||||
* file that was distributed with this source code.
|
||||
*/
|
||||
|
||||
namespace Sylius\Component\Metadata\Compiler;
|
||||
|
||||
use Sylius\Component\Metadata\Model\MetadataInterface;
|
||||
|
||||
/**
|
||||
* @author Kamil Kokot <kamil.kokot@lakion.com>
|
||||
*/
|
||||
final class MetadataCompiler implements MetadataCompilerInterface
|
||||
{
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function compile(MetadataInterface $metadata, array $parents = [])
|
||||
{
|
||||
$compiledMetadata = clone $metadata;
|
||||
|
||||
/** @var MetadataInterface[] $parents */
|
||||
foreach ($parents as $parent) {
|
||||
$compiledMetadata->merge($parent);
|
||||
}
|
||||
|
||||
return $compiledMetadata;
|
||||
}
|
||||
}
|
||||
|
|
@ -1,28 +0,0 @@
|
|||
<?php
|
||||
|
||||
/*
|
||||
* This file is part of the Sylius package.
|
||||
*
|
||||
* (c) Paweł Jędrzejewski
|
||||
*
|
||||
* For the full copyright and license information, please view the LICENSE
|
||||
* file that was distributed with this source code.
|
||||
*/
|
||||
|
||||
namespace Sylius\Component\Metadata\Compiler;
|
||||
|
||||
use Sylius\Component\Metadata\Model\MetadataInterface;
|
||||
|
||||
/**
|
||||
* @author Kamil Kokot <kamil.kokot@lakion.com>
|
||||
*/
|
||||
interface MetadataCompilerInterface
|
||||
{
|
||||
/**
|
||||
* @param MetadataInterface $metadata
|
||||
* @param MetadataInterface[] $parents
|
||||
*
|
||||
* @return MetadataInterface
|
||||
*/
|
||||
public function compile(MetadataInterface $metadata, array $parents = []);
|
||||
}
|
||||
|
|
@ -1,55 +0,0 @@
|
|||
<?php
|
||||
|
||||
/*
|
||||
* This file is part of the Sylius package.
|
||||
*
|
||||
* (c) Paweł Jędrzejewski
|
||||
*
|
||||
* For the full copyright and license information, please view the LICENSE
|
||||
* file that was distributed with this source code.
|
||||
*/
|
||||
|
||||
namespace Sylius\Component\Metadata\Factory;
|
||||
|
||||
use Sylius\Component\Metadata\Model\MetadataContainerInterface;
|
||||
use Sylius\Component\Resource\Factory\FactoryInterface;
|
||||
|
||||
/**
|
||||
* @author Kamil Kokot <kamil.kokot@lakion.com>
|
||||
*/
|
||||
final class MetadataContainerFactory implements MetadataContainerFactoryInterface, FactoryInterface
|
||||
{
|
||||
/**
|
||||
* @var string
|
||||
*/
|
||||
private $metadataContainerClass;
|
||||
|
||||
/**
|
||||
* @param string $metadataContainerClass
|
||||
*/
|
||||
public function __construct($metadataContainerClass)
|
||||
{
|
||||
$this->metadataContainerClass = $metadataContainerClass;
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*
|
||||
* @return MetadataContainerInterface
|
||||
*/
|
||||
public function createNew()
|
||||
{
|
||||
return new $this->metadataContainerClass();
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function createIdentifiedBy($id)
|
||||
{
|
||||
$metadataContainer = $this->createNew();
|
||||
$metadataContainer->setId($id);
|
||||
|
||||
return $metadataContainer;
|
||||
}
|
||||
}
|
||||
|
|
@ -1,27 +0,0 @@
|
|||
<?php
|
||||
|
||||
/*
|
||||
* This file is part of the Sylius package.
|
||||
*
|
||||
* (c) Paweł Jędrzejewski
|
||||
*
|
||||
* For the full copyright and license information, please view the LICENSE
|
||||
* file that was distributed with this source code.
|
||||
*/
|
||||
|
||||
namespace Sylius\Component\Metadata\Factory;
|
||||
|
||||
use Sylius\Component\Metadata\Model\MetadataContainerInterface;
|
||||
|
||||
/**
|
||||
* @author Kamil Kokot <kamil.kokot@lakion.com>
|
||||
*/
|
||||
interface MetadataContainerFactoryInterface
|
||||
{
|
||||
/**
|
||||
* @param string $id
|
||||
*
|
||||
* @return MetadataContainerInterface
|
||||
*/
|
||||
public function createIdentifiedBy($id);
|
||||
}
|
||||
|
|
@ -1,77 +0,0 @@
|
|||
<?php
|
||||
|
||||
/*
|
||||
* This file is part of the Sylius package.
|
||||
*
|
||||
* (c) Paweł Jędrzejewski
|
||||
*
|
||||
* For the full copyright and license information, please view the LICENSE
|
||||
* file that was distributed with this source code.
|
||||
*/
|
||||
|
||||
namespace Sylius\Component\Metadata\HierarchyProvider;
|
||||
|
||||
use Sylius\Component\Metadata\Model\MetadataSubjectInterface;
|
||||
|
||||
/**
|
||||
* @author Kamil Kokot <kamil.kokot@lakion.com>
|
||||
*/
|
||||
final class CompositeMetadataHierarchyProvider implements MetadataHierarchyProviderInterface
|
||||
{
|
||||
/**
|
||||
* @var MetadataHierarchyProviderInterface[]
|
||||
*/
|
||||
private $providers;
|
||||
|
||||
/**
|
||||
* @param MetadataHierarchyProviderInterface[] $providers
|
||||
*/
|
||||
public function __construct(array $providers = [])
|
||||
{
|
||||
$this->assertProvidersHaveCorrectType($providers);
|
||||
|
||||
$this->providers = $providers;
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function getHierarchyByMetadataSubject(MetadataSubjectInterface $metadataSubject)
|
||||
{
|
||||
foreach ($this->providers as $provider) {
|
||||
if ($provider->supports($metadataSubject)) {
|
||||
return $provider->getHierarchyByMetadataSubject($metadataSubject);
|
||||
}
|
||||
}
|
||||
|
||||
return [
|
||||
$metadataSubject->getMetadataIdentifier(),
|
||||
$metadataSubject->getMetadataClassIdentifier(),
|
||||
];
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function supports(MetadataSubjectInterface $metadataSubject)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param MetadataHierarchyProviderInterface[] $providers
|
||||
*/
|
||||
private function assertProvidersHaveCorrectType(array $providers)
|
||||
{
|
||||
foreach ($providers as $provider) {
|
||||
if ($provider instanceof MetadataHierarchyProviderInterface) {
|
||||
continue;
|
||||
}
|
||||
|
||||
throw new \InvalidArgumentException(sprintf(
|
||||
'Metadata hierarchy provider should have type "%s"',
|
||||
MetadataHierarchyProviderInterface::class
|
||||
));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -1,36 +0,0 @@
|
|||
<?php
|
||||
|
||||
/*
|
||||
* This file is part of the Sylius package.
|
||||
*
|
||||
* (c) Paweł Jędrzejewski
|
||||
*
|
||||
* For the full copyright and license information, please view the LICENSE
|
||||
* file that was distributed with this source code.
|
||||
*/
|
||||
|
||||
namespace Sylius\Component\Metadata\HierarchyProvider;
|
||||
|
||||
use Sylius\Component\Metadata\Model\MetadataSubjectInterface;
|
||||
|
||||
/**
|
||||
* @author Kamil Kokot <kamil.kokot@lakion.com>
|
||||
*/
|
||||
interface MetadataHierarchyProviderInterface
|
||||
{
|
||||
/**
|
||||
* Returns identifiers in order from the most specific to the least specific.
|
||||
*
|
||||
* @param MetadataSubjectInterface $metadataSubject
|
||||
*
|
||||
* @return string[]
|
||||
*/
|
||||
public function getHierarchyByMetadataSubject(MetadataSubjectInterface $metadataSubject);
|
||||
|
||||
/**
|
||||
* @param MetadataSubjectInterface $metadataSubject
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
public function supports(MetadataSubjectInterface $metadataSubject);
|
||||
}
|
||||
|
|
@ -1,19 +0,0 @@
|
|||
Copyright (c) 2011-2016 Paweł Jędrzejewski
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
in the Software without restriction, including without limitation the rights
|
||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
copies of the Software, and to permit persons to whom the Software is furnished
|
||||
to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in all
|
||||
copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
THE SOFTWARE.
|
||||
|
|
@ -1,78 +0,0 @@
|
|||
<?php
|
||||
|
||||
/*
|
||||
* This file is part of the Sylius package.
|
||||
*
|
||||
* (c) Paweł Jędrzejewski
|
||||
*
|
||||
* For the full copyright and license information, please view the LICENSE
|
||||
* file that was distributed with this source code.
|
||||
*/
|
||||
|
||||
namespace Sylius\Component\Metadata\Model;
|
||||
|
||||
/**
|
||||
* Base metadata class with reusable merging ability.
|
||||
*
|
||||
* @author Kamil Kokot <kamil.kokot@lakion.com>
|
||||
*/
|
||||
abstract class AbstractMetadata implements MetadataInterface
|
||||
{
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function merge(MetadataInterface $metadata)
|
||||
{
|
||||
if (!$metadata instanceof $this || !$this instanceof $metadata) {
|
||||
throw new \InvalidArgumentException(
|
||||
sprintf(
|
||||
'You can only merge instances of the same classes. Tried to merge "%s" with "%s".',
|
||||
get_class($this),
|
||||
get_class($metadata)
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
$inheritedVariables = get_object_vars($metadata);
|
||||
foreach ($inheritedVariables as $inheritedKey => $inheritedValue) {
|
||||
if ($this->{$inheritedKey} instanceof MetadataInterface) {
|
||||
$this->{$inheritedKey}->merge($inheritedValue);
|
||||
|
||||
continue;
|
||||
}
|
||||
|
||||
if (null !== $this->{$inheritedKey}) {
|
||||
continue;
|
||||
}
|
||||
|
||||
$this->{$inheritedKey} = $inheritedValue;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function toArray()
|
||||
{
|
||||
return array_map(
|
||||
function ($value) {
|
||||
if ($value instanceof MetadataInterface) {
|
||||
$value = $value->toArray();
|
||||
}
|
||||
|
||||
return $value;
|
||||
},
|
||||
get_object_vars($this)
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function forAll(callable $callable)
|
||||
{
|
||||
foreach (get_object_vars($this) as $key => $value) {
|
||||
$this->$key = $callable($value);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -1,126 +0,0 @@
|
|||
<?php
|
||||
|
||||
/*
|
||||
* This file is part of the Sylius package.
|
||||
*
|
||||
* (c) Paweł Jędrzejewski
|
||||
*
|
||||
* For the full copyright and license information, please view the LICENSE
|
||||
* file that was distributed with this source code.
|
||||
*/
|
||||
|
||||
namespace Sylius\Component\Metadata\Model\Custom;
|
||||
|
||||
use Sylius\Component\Metadata\Model\AbstractMetadata;
|
||||
use Sylius\Component\Metadata\Model\Twitter\CardInterface;
|
||||
|
||||
/**
|
||||
* @author Kamil Kokot <kamil.kokot@lakion.com>
|
||||
*/
|
||||
class PageMetadata extends AbstractMetadata implements PageMetadataInterface
|
||||
{
|
||||
/**
|
||||
* @var string
|
||||
*/
|
||||
protected $title;
|
||||
|
||||
/**
|
||||
* @var string
|
||||
*/
|
||||
protected $description;
|
||||
|
||||
/**
|
||||
* @var string[]
|
||||
*/
|
||||
protected $keywords = [];
|
||||
|
||||
/**
|
||||
* @var string
|
||||
*/
|
||||
protected $charset = 'UTF-8';
|
||||
|
||||
/**
|
||||
* @var CardInterface
|
||||
*/
|
||||
protected $twitter;
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function getTitle()
|
||||
{
|
||||
return $this->title;
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function setTitle($title)
|
||||
{
|
||||
$this->title = $title;
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function getDescription()
|
||||
{
|
||||
return $this->description;
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function setDescription($description)
|
||||
{
|
||||
$this->description = $description;
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function getKeywords()
|
||||
{
|
||||
return $this->keywords;
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function setKeywords(array $keywords)
|
||||
{
|
||||
$this->keywords = $keywords;
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function getCharset()
|
||||
{
|
||||
return $this->charset;
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function setCharset($charset)
|
||||
{
|
||||
$this->charset = $charset;
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function getTwitter()
|
||||
{
|
||||
return $this->twitter;
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function setTwitter(CardInterface $twitter = null)
|
||||
{
|
||||
$this->twitter = $twitter;
|
||||
}
|
||||
}
|
||||
|
|
@ -1,71 +0,0 @@
|
|||
<?php
|
||||
|
||||
/*
|
||||
* This file is part of the Sylius package.
|
||||
*
|
||||
* (c) Paweł Jędrzejewski
|
||||
*
|
||||
* For the full copyright and license information, please view the LICENSE
|
||||
* file that was distributed with this source code.
|
||||
*/
|
||||
|
||||
namespace Sylius\Component\Metadata\Model\Custom;
|
||||
|
||||
use Sylius\Component\Metadata\Model\MetadataInterface;
|
||||
use Sylius\Component\Metadata\Model\Twitter\CardInterface;
|
||||
|
||||
/**
|
||||
* @author Kamil Kokot <kamil.kokot@lakion.com>
|
||||
*/
|
||||
interface PageMetadataInterface extends MetadataInterface
|
||||
{
|
||||
/**
|
||||
* @return string
|
||||
*/
|
||||
public function getTitle();
|
||||
|
||||
/**
|
||||
* @param string $title
|
||||
*/
|
||||
public function setTitle($title);
|
||||
|
||||
/**
|
||||
* @return string
|
||||
*/
|
||||
public function getDescription();
|
||||
|
||||
/**
|
||||
* @param string $description
|
||||
*/
|
||||
public function setDescription($description);
|
||||
|
||||
/**
|
||||
* @return string[]
|
||||
*/
|
||||
public function getKeywords();
|
||||
|
||||
/**
|
||||
* @param string[] $keywords
|
||||
*/
|
||||
public function setKeywords(array $keywords);
|
||||
|
||||
/**
|
||||
* @return string
|
||||
*/
|
||||
public function getCharset();
|
||||
|
||||
/**
|
||||
* @param string $charset
|
||||
*/
|
||||
public function setCharset($charset);
|
||||
|
||||
/**
|
||||
* @return CardInterface|null
|
||||
*/
|
||||
public function getTwitter();
|
||||
|
||||
/**
|
||||
* @param CardInterface|null $card
|
||||
*/
|
||||
public function setTwitter(CardInterface $card = null);
|
||||
}
|
||||
|
|
@ -1,60 +0,0 @@
|
|||
<?php
|
||||
|
||||
/*
|
||||
* This file is part of the Sylius package.
|
||||
*
|
||||
* (c) Paweł Jędrzejewski
|
||||
*
|
||||
* For the full copyright and license information, please view the LICENSE
|
||||
* file that was distributed with this source code.
|
||||
*/
|
||||
|
||||
namespace Sylius\Component\Metadata\Model;
|
||||
|
||||
/**
|
||||
* @author Kamil Kokot <kamil.kokot@lakion.com>
|
||||
*/
|
||||
class MetadataContainer implements MetadataContainerInterface
|
||||
{
|
||||
/**
|
||||
* @var string
|
||||
*/
|
||||
protected $id;
|
||||
|
||||
/**
|
||||
* @var MetadataInterface
|
||||
*/
|
||||
protected $metadata;
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function getId()
|
||||
{
|
||||
return $this->id;
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function setId($id)
|
||||
{
|
||||
$this->id = $id;
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function getMetadata()
|
||||
{
|
||||
return $this->metadata;
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function setMetadata(MetadataInterface $metadata)
|
||||
{
|
||||
$this->metadata = $metadata;
|
||||
}
|
||||
}
|
||||
|
|
@ -1,40 +0,0 @@
|
|||
<?php
|
||||
|
||||
/*
|
||||
* This file is part of the Sylius package.
|
||||
*
|
||||
* (c) Paweł Jędrzejewski
|
||||
*
|
||||
* For the full copyright and license information, please view the LICENSE
|
||||
* file that was distributed with this source code.
|
||||
*/
|
||||
|
||||
namespace Sylius\Component\Metadata\Model;
|
||||
|
||||
use Sylius\Component\Resource\Model\ResourceInterface;
|
||||
|
||||
/**
|
||||
* @author Kamil Kokot <kamil.kokot@lakion.com>
|
||||
*/
|
||||
interface MetadataContainerInterface extends ResourceInterface
|
||||
{
|
||||
/**
|
||||
* @return string
|
||||
*/
|
||||
public function getId();
|
||||
|
||||
/**
|
||||
* @param string $id
|
||||
*/
|
||||
public function setId($id);
|
||||
|
||||
/**
|
||||
* @return MetadataInterface
|
||||
*/
|
||||
public function getMetadata();
|
||||
|
||||
/**
|
||||
* @param MetadataInterface $metadata
|
||||
*/
|
||||
public function setMetadata(MetadataInterface $metadata);
|
||||
}
|
||||
|
|
@ -1,33 +0,0 @@
|
|||
<?php
|
||||
|
||||
/*
|
||||
* This file is part of the Sylius package.
|
||||
*
|
||||
* (c) Paweł Jędrzejewski
|
||||
*
|
||||
* For the full copyright and license information, please view the LICENSE
|
||||
* file that was distributed with this source code.
|
||||
*/
|
||||
|
||||
namespace Sylius\Component\Metadata\Model;
|
||||
|
||||
/**
|
||||
* @author Kamil Kokot <kamil.kokot@lakion.com>
|
||||
*/
|
||||
interface MetadataInterface
|
||||
{
|
||||
/**
|
||||
* @param MetadataInterface $metadata
|
||||
*/
|
||||
public function merge(MetadataInterface $metadata);
|
||||
|
||||
/**
|
||||
* @return array
|
||||
*/
|
||||
public function toArray();
|
||||
|
||||
/**
|
||||
* @param callable $callable
|
||||
*/
|
||||
public function forAll(callable $callable);
|
||||
}
|
||||
|
|
@ -1,32 +0,0 @@
|
|||
<?php
|
||||
|
||||
/*
|
||||
* This file is part of the Sylius package.
|
||||
*
|
||||
* (c) Paweł Jędrzejewski
|
||||
*
|
||||
* For the full copyright and license information, please view the LICENSE
|
||||
* file that was distributed with this source code.
|
||||
*/
|
||||
|
||||
namespace Sylius\Component\Metadata\Model;
|
||||
|
||||
/**
|
||||
* @author Kamil Kokot <kamil.kokot@lakion.com>
|
||||
*/
|
||||
interface MetadataSubjectInterface
|
||||
{
|
||||
/**
|
||||
* Metadata class identifier is usually a class name (not FQCN), eg. "MetadataSubject".
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getMetadataClassIdentifier();
|
||||
|
||||
/**
|
||||
* Metadata identifier is usually a class name (not FQCN) and ID joined by dash, eg. "MetadataSubject-42".
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getMetadataIdentifier();
|
||||
}
|
||||
|
|
@ -1,75 +0,0 @@
|
|||
<?php
|
||||
|
||||
/*
|
||||
* This file is part of the Sylius package.
|
||||
*
|
||||
* (c) Paweł Jędrzejewski
|
||||
*
|
||||
* For the full copyright and license information, please view the LICENSE
|
||||
* file that was distributed with this source code.
|
||||
*/
|
||||
|
||||
namespace Sylius\Component\Metadata\Model\Twitter;
|
||||
|
||||
use Sylius\Component\Metadata\Model\AbstractMetadata;
|
||||
|
||||
/**
|
||||
* @author Kamil Kokot <kamil.kokot@lakion.com>
|
||||
*/
|
||||
abstract class AbstractCard extends AbstractMetadata implements CardInterface
|
||||
{
|
||||
/**
|
||||
* @var string
|
||||
*/
|
||||
protected $type;
|
||||
|
||||
/**
|
||||
* @var string
|
||||
*/
|
||||
protected $site;
|
||||
|
||||
/**
|
||||
* @var string
|
||||
*/
|
||||
protected $siteId;
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function getType()
|
||||
{
|
||||
return $this->type;
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function getSite()
|
||||
{
|
||||
return $this->site;
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function setSite($site)
|
||||
{
|
||||
$this->site = $site;
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function getSiteId()
|
||||
{
|
||||
return $this->siteId;
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function setSiteId($siteId)
|
||||
{
|
||||
$this->siteId = $siteId;
|
||||
}
|
||||
}
|
||||
|
|
@ -1,235 +0,0 @@
|
|||
<?php
|
||||
|
||||
/*
|
||||
* This file is part of the Sylius package.
|
||||
*
|
||||
* (c) Paweł Jędrzejewski
|
||||
*
|
||||
* For the full copyright and license information, please view the LICENSE
|
||||
* file that was distributed with this source code.
|
||||
*/
|
||||
|
||||
namespace Sylius\Component\Metadata\Model\Twitter;
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*
|
||||
* @author Kamil Kokot <kamil.kokot@lakion.com>
|
||||
*/
|
||||
class AppCard extends AbstractCard implements AppCardInterface
|
||||
{
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
protected $type = 'app';
|
||||
|
||||
/**
|
||||
* @var string
|
||||
*/
|
||||
protected $description;
|
||||
|
||||
/**
|
||||
* @var string
|
||||
*/
|
||||
protected $appNameIphone;
|
||||
|
||||
/**
|
||||
* @var string
|
||||
*/
|
||||
protected $appIdIphone;
|
||||
|
||||
/**
|
||||
* @var string
|
||||
*/
|
||||
protected $appUrlIphone;
|
||||
|
||||
/**
|
||||
* @var string
|
||||
*/
|
||||
protected $appNameIpad;
|
||||
|
||||
/**
|
||||
* @var string
|
||||
*/
|
||||
protected $appIdIpad;
|
||||
|
||||
/**
|
||||
* @var string
|
||||
*/
|
||||
protected $appUrlIpad;
|
||||
|
||||
/**
|
||||
* @var string
|
||||
*/
|
||||
protected $appNameGooglePlay;
|
||||
|
||||
/**
|
||||
* @var string
|
||||
*/
|
||||
protected $appIdGooglePlay;
|
||||
|
||||
/**
|
||||
* @var string
|
||||
*/
|
||||
protected $appUrlGooglePlay;
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function getDescription()
|
||||
{
|
||||
return $this->description;
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function setDescription($description)
|
||||
{
|
||||
$this->description = $description;
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function getAppNameIphone()
|
||||
{
|
||||
return $this->appNameIphone;
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function setAppNameIphone($appNameIphone)
|
||||
{
|
||||
$this->appNameIphone = $appNameIphone;
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function getAppIdIphone()
|
||||
{
|
||||
return $this->appIdIphone;
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function setAppIdIphone($appIdIphone)
|
||||
{
|
||||
$this->appIdIphone = $appIdIphone;
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function getAppUrlIphone()
|
||||
{
|
||||
return $this->appUrlIphone;
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function setAppUrlIphone($appUrlIphone)
|
||||
{
|
||||
$this->appUrlIphone = $appUrlIphone;
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function getAppNameIpad()
|
||||
{
|
||||
return $this->appNameIpad;
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function setAppNameIpad($appNameIpad)
|
||||
{
|
||||
$this->appNameIpad = $appNameIpad;
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function getAppIdIpad()
|
||||
{
|
||||
return $this->appIdIpad;
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function setAppIdIpad($appIdIpad)
|
||||
{
|
||||
$this->appIdIpad = $appIdIpad;
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function getAppUrlIpad()
|
||||
{
|
||||
return $this->appUrlIpad;
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function setAppUrlIpad($appUrlIpad)
|
||||
{
|
||||
$this->appUrlIpad = $appUrlIpad;
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function getAppNameGooglePlay()
|
||||
{
|
||||
return $this->appNameGooglePlay;
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function setAppNameGooglePlay($appNameGooglePlay)
|
||||
{
|
||||
$this->appNameGooglePlay = $appNameGooglePlay;
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function getAppIdGooglePlay()
|
||||
{
|
||||
return $this->appIdGooglePlay;
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function setAppIdGooglePlay($appIdGooglePlay)
|
||||
{
|
||||
$this->appIdGooglePlay = $appIdGooglePlay;
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function getAppUrlGooglePlay()
|
||||
{
|
||||
return $this->appUrlGooglePlay;
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function setAppUrlGooglePlay($appUrlGooglePlay)
|
||||
{
|
||||
$this->appUrlGooglePlay = $appUrlGooglePlay;
|
||||
}
|
||||
}
|
||||
|
|
@ -1,160 +0,0 @@
|
|||
<?php
|
||||
|
||||
/*
|
||||
* This file is part of the Sylius package.
|
||||
*
|
||||
* (c) Paweł Jędrzejewski
|
||||
*
|
||||
* For the full copyright and license information, please view the LICENSE
|
||||
* file that was distributed with this source code.
|
||||
*/
|
||||
|
||||
namespace Sylius\Component\Metadata\Model\Twitter;
|
||||
|
||||
/**
|
||||
* @see https://dev.twitter.com/cards/types/app
|
||||
*
|
||||
* @author Kamil Kokot <kamil.kokot@lakion.com>
|
||||
*/
|
||||
interface AppCardInterface extends CardInterface
|
||||
{
|
||||
/**
|
||||
* The twitter:description property.
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getDescription();
|
||||
|
||||
/**
|
||||
* The twitter:description property.
|
||||
*
|
||||
* @param string $description
|
||||
*/
|
||||
public function setDescription($description);
|
||||
|
||||
/**
|
||||
* The twitter:app:name:iphone property.
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getAppNameIphone();
|
||||
|
||||
/**
|
||||
* The twitter:app:name:iphone property.
|
||||
*
|
||||
* @param string $appNameIphone
|
||||
*/
|
||||
public function setAppNameIphone($appNameIphone);
|
||||
|
||||
/**
|
||||
* The twitter:app:id:iphone property.
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getAppIdIphone();
|
||||
|
||||
/**
|
||||
* The twitter:app:id:iphone property.
|
||||
*
|
||||
* @param string $appIdIphone
|
||||
*/
|
||||
public function setAppIdIphone($appIdIphone);
|
||||
|
||||
/**
|
||||
* The twitter:app:url:iphone property.
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getAppUrlIphone();
|
||||
|
||||
/**
|
||||
* The twitter:app:url:iphone property.
|
||||
*
|
||||
* @param string $appUrlIphone
|
||||
*/
|
||||
public function setAppUrlIphone($appUrlIphone);
|
||||
|
||||
/**
|
||||
* The twitter:app:name:ipad property.
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getAppNameIpad();
|
||||
|
||||
/**
|
||||
* The twitter:app:name:ipad property.
|
||||
*
|
||||
* @param string $appNameIpad
|
||||
*/
|
||||
public function setAppNameIpad($appNameIpad);
|
||||
|
||||
/**
|
||||
* The twitter:app:id:ipad property.
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getAppIdIpad();
|
||||
|
||||
/**
|
||||
* The twitter:app:id:ipad property.
|
||||
*
|
||||
* @param string $appIdIpad
|
||||
*/
|
||||
public function setAppIdIpad($appIdIpad);
|
||||
|
||||
/**
|
||||
* The twitter:app:url:ipad property.
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getAppUrlIpad();
|
||||
|
||||
/**
|
||||
* The twitter:app:url:ipad property.
|
||||
*
|
||||
* @param string $appUrlIpad
|
||||
*/
|
||||
public function setAppUrlIpad($appUrlIpad);
|
||||
|
||||
/**
|
||||
* The twitter:app:name:googleplay property.
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getAppNameGooglePlay();
|
||||
|
||||
/**
|
||||
* The twitter:app:name:googleplay property.
|
||||
*
|
||||
* @param string $appNameGooglePlay
|
||||
*/
|
||||
public function setAppNameGooglePlay($appNameGooglePlay);
|
||||
|
||||
/**
|
||||
* The twitter:app:id:googleplay property.
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getAppIdGooglePlay();
|
||||
|
||||
/**
|
||||
* The twitter:app:id:googleplay property.
|
||||
*
|
||||
* @param string $appIdGooglePlay
|
||||
*/
|
||||
public function setAppIdGooglePlay($appIdGooglePlay);
|
||||
|
||||
/**
|
||||
* The twitter:app:url:googleplay property.
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getAppUrlGooglePlay();
|
||||
|
||||
/**
|
||||
* The twitter:app:url:googleplay property.
|
||||
*
|
||||
* @param string $appUrlGooglePlay
|
||||
*/
|
||||
public function setAppUrlGooglePlay($appUrlGooglePlay);
|
||||
}
|
||||
|
|
@ -1,55 +0,0 @@
|
|||
<?php
|
||||
|
||||
/*
|
||||
* This file is part of the Sylius package.
|
||||
*
|
||||
* (c) Paweł Jędrzejewski
|
||||
*
|
||||
* For the full copyright and license information, please view the LICENSE
|
||||
* file that was distributed with this source code.
|
||||
*/
|
||||
|
||||
namespace Sylius\Component\Metadata\Model\Twitter;
|
||||
|
||||
use Sylius\Component\Metadata\Model\MetadataInterface;
|
||||
|
||||
/**
|
||||
* @author Kamil Kokot <kamil.kokot@lakion.com>
|
||||
*/
|
||||
interface CardInterface extends MetadataInterface
|
||||
{
|
||||
/**
|
||||
* The twitter:card property.
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getType();
|
||||
|
||||
/**
|
||||
* The twitter:site property.
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getSite();
|
||||
|
||||
/**
|
||||
* The twitter:site property.
|
||||
*
|
||||
* @param string $site
|
||||
*/
|
||||
public function setSite($site);
|
||||
|
||||
/**
|
||||
* The twitter:site:id property.
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getSiteId();
|
||||
|
||||
/**
|
||||
* The twitter:site:id property.
|
||||
*
|
||||
* @param string $siteId
|
||||
*/
|
||||
public function setSiteId($siteId);
|
||||
}
|
||||
|
|
@ -1,193 +0,0 @@
|
|||
<?php
|
||||
|
||||
/*
|
||||
* This file is part of the Sylius package.
|
||||
*
|
||||
* (c) Paweł Jędrzejewski
|
||||
*
|
||||
* For the full copyright and license information, please view the LICENSE
|
||||
* file that was distributed with this source code.
|
||||
*/
|
||||
|
||||
namespace Sylius\Component\Metadata\Model\Twitter;
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*
|
||||
* @author Kamil Kokot <kamil.kokot@lakion.com>
|
||||
*/
|
||||
class PlayerCard extends AbstractCard implements PlayerCardInterface
|
||||
{
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
protected $type = 'player';
|
||||
|
||||
/**
|
||||
* @var string
|
||||
*/
|
||||
protected $title;
|
||||
|
||||
/**
|
||||
* @var string
|
||||
*/
|
||||
protected $description;
|
||||
|
||||
/**
|
||||
* @var string
|
||||
*/
|
||||
protected $image;
|
||||
|
||||
/**
|
||||
* @var string
|
||||
*/
|
||||
protected $player;
|
||||
|
||||
/**
|
||||
* @var int
|
||||
*/
|
||||
protected $playerWidth;
|
||||
|
||||
/**
|
||||
* @var int
|
||||
*/
|
||||
protected $playerHeight;
|
||||
|
||||
/**
|
||||
* @var string
|
||||
*/
|
||||
protected $playerStream;
|
||||
|
||||
/**
|
||||
* @var string
|
||||
*/
|
||||
protected $playerStreamContentType;
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function getTitle()
|
||||
{
|
||||
return $this->title;
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function setTitle($title)
|
||||
{
|
||||
$this->title = $title;
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function getDescription()
|
||||
{
|
||||
return $this->description;
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function setDescription($description)
|
||||
{
|
||||
$this->description = $description;
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function getImage()
|
||||
{
|
||||
return $this->image;
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function setImage($image)
|
||||
{
|
||||
$this->image = $image;
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function getPlayer()
|
||||
{
|
||||
return $this->player;
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function setPlayer($player)
|
||||
{
|
||||
$this->player = $player;
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function getPlayerWidth()
|
||||
{
|
||||
return $this->playerWidth;
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function setPlayerWidth($playerWidth)
|
||||
{
|
||||
$this->playerWidth = $playerWidth;
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function getPlayerHeight()
|
||||
{
|
||||
return $this->playerHeight;
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function setPlayerHeight($playerHeight)
|
||||
{
|
||||
$this->playerHeight = $playerHeight;
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function getPlayerStream()
|
||||
{
|
||||
return $this->playerStream;
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function setPlayerStream($playerStream)
|
||||
{
|
||||
$this->playerStream = $playerStream;
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function getPlayerStreamContentType()
|
||||
{
|
||||
return $this->playerStreamContentType;
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function setPlayerStreamContentType($playerStreamContentType)
|
||||
{
|
||||
$this->playerStreamContentType = $playerStreamContentType;
|
||||
}
|
||||
}
|
||||
|
|
@ -1,132 +0,0 @@
|
|||
<?php
|
||||
|
||||
/*
|
||||
* This file is part of the Sylius package.
|
||||
*
|
||||
* (c) Paweł Jędrzejewski
|
||||
*
|
||||
* For the full copyright and license information, please view the LICENSE
|
||||
* file that was distributed with this source code.
|
||||
*/
|
||||
|
||||
namespace Sylius\Component\Metadata\Model\Twitter;
|
||||
|
||||
/**
|
||||
* @see https://dev.twitter.com/cards/types/player
|
||||
*
|
||||
* @author Kamil Kokot <kamil.kokot@lakion.com>
|
||||
*/
|
||||
interface PlayerCardInterface extends CardInterface
|
||||
{
|
||||
/**
|
||||
* The twitter:title property.
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getTitle();
|
||||
|
||||
/**
|
||||
* The twitter:title property.
|
||||
*
|
||||
* @param string $title
|
||||
*/
|
||||
public function setTitle($title);
|
||||
|
||||
/**
|
||||
* The twitter:description property.
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getDescription();
|
||||
|
||||
/**
|
||||
* The twitter:description property.
|
||||
*
|
||||
* @param string $description
|
||||
*/
|
||||
public function setDescription($description);
|
||||
|
||||
/**
|
||||
* The twitter:image property.
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getImage();
|
||||
|
||||
/**
|
||||
* The twitter:image property.
|
||||
*
|
||||
* @param string $image
|
||||
*/
|
||||
public function setImage($image);
|
||||
|
||||
/**
|
||||
* The twitter:player property.
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getPlayer();
|
||||
|
||||
/**
|
||||
* The twitter:player property.
|
||||
*
|
||||
* @param string $player
|
||||
*/
|
||||
public function setPlayer($player);
|
||||
|
||||
/**
|
||||
* The twitter:player:width property.
|
||||
*
|
||||
* @return int
|
||||
*/
|
||||
public function getPlayerWidth();
|
||||
|
||||
/**
|
||||
* The twitter:player:width property.
|
||||
*
|
||||
* @param int $playerWidth
|
||||
*/
|
||||
public function setPlayerWidth($playerWidth);
|
||||
|
||||
/**
|
||||
* The twitter:player:height property.
|
||||
*
|
||||
* @return int
|
||||
*/
|
||||
public function getPlayerHeight();
|
||||
|
||||
/**
|
||||
* The twitter:player:height property.
|
||||
*
|
||||
* @param int $playerHeight
|
||||
*/
|
||||
public function setPlayerHeight($playerHeight);
|
||||
|
||||
/**
|
||||
* The twitter:player:stream property.
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getPlayerStream();
|
||||
|
||||
/**
|
||||
* The twitter:player:stream property.
|
||||
*
|
||||
* @param string $playerStream
|
||||
*/
|
||||
public function setPlayerStream($playerStream);
|
||||
|
||||
/**
|
||||
* The twitter:player:stream:content_type property.
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getPlayerStreamContentType();
|
||||
|
||||
/**
|
||||
* The twitter:player:stream:content_type property.
|
||||
*
|
||||
* @param string $playerStreamContentType
|
||||
*/
|
||||
public function setPlayerStreamContentType($playerStreamContentType);
|
||||
}
|
||||
|
|
@ -1,109 +0,0 @@
|
|||
<?php
|
||||
|
||||
/*
|
||||
* This file is part of the Sylius package.
|
||||
*
|
||||
* (c) Paweł Jędrzejewski
|
||||
*
|
||||
* For the full copyright and license information, please view the LICENSE
|
||||
* file that was distributed with this source code.
|
||||
*/
|
||||
|
||||
namespace Sylius\Component\Metadata\Model\Twitter;
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*
|
||||
* @author Kamil Kokot <kamil.kokot@lakion.com>
|
||||
*/
|
||||
class SummaryCard extends AbstractCard implements SummaryCardInterface
|
||||
{
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
protected $type = 'summary';
|
||||
|
||||
/**
|
||||
* @var string
|
||||
*/
|
||||
protected $creatorId;
|
||||
|
||||
/**
|
||||
* @var string
|
||||
*/
|
||||
protected $title;
|
||||
|
||||
/**
|
||||
* @var string
|
||||
*/
|
||||
protected $description;
|
||||
|
||||
/**
|
||||
* @var string
|
||||
*/
|
||||
protected $image;
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function getCreatorId()
|
||||
{
|
||||
return $this->creatorId;
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function setCreatorId($creatorId)
|
||||
{
|
||||
$this->creatorId = $creatorId;
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function getTitle()
|
||||
{
|
||||
return $this->title;
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function setTitle($title)
|
||||
{
|
||||
$this->title = $title;
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function getDescription()
|
||||
{
|
||||
return $this->description;
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function setDescription($description)
|
||||
{
|
||||
$this->description = $description;
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function getImage()
|
||||
{
|
||||
return $this->image;
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function setImage($image)
|
||||
{
|
||||
$this->image = $image;
|
||||
}
|
||||
}
|
||||
Some files were not shown because too many files have changed in this diff Show more
Loading…
Add table
Reference in a new issue