本文整理汇总了PHP中Sonata\BlockBundle\Model\BlockInterface::getSetting方法的典型用法代码示例。如果您正苦于以下问题:PHP BlockInterface::getSetting方法的具体用法?PHP BlockInterface::getSetting怎么用?PHP BlockInterface::getSetting使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Sonata\BlockBundle\Model\BlockInterface
的用法示例。
在下文中一共展示了BlockInterface::getSetting方法的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: execute
/**
* {@inheritdoc}
*/
public function execute(BlockInterface $block, Response $response = null)
{
$parameters = (array) json_decode($block->getSetting('parameters'), true);
$parameters = array_merge($parameters, array('_block' => $block));
$settings = array_merge($this->getDefaultSettings(), (array) $block->getSettings());
try {
$actionContent = $this->kernel->render($settings['action'], $parameters);
} catch (\Exception $e) {
throw $e;
}
$content = self::mustache($block->getSetting('layout'), array('CONTENT' => $actionContent));
return $this->renderResponse('SonataBlockBundle:Block:block_core_action.html.twig', array('content' => $content, 'block' => $block), $response);
}
示例2: validateBlock
/**
* {@inheritdoc}
*/
public function validateBlock(ErrorElement $errorElement, BlockInterface $block)
{
if (($name = $block->getSetting('menu_name')) && $name !== '' && !$this->menuProvider->has($name)) {
// If we specified a menu_name, check that it exists
$errorElement->with('menu_name')->addViolation('sonata.block.menu.not_existing', array('name' => $name))->end();
}
}
示例3: buildEditForm
/**
* {@inheritdoc}
*/
public function buildEditForm(FormMapper $formMapper, BlockInterface $block)
{
$contextChoices = $this->getContextChoices();
$formatChoices = $this->getFormatChoices($block->getSetting('mediaId'));
$translator = $this->container->get('translator');
$formMapper->add('settings', 'sonata_type_immutable_array', array('keys' => array(array('title', 'text', array('required' => false)), array('content', 'textarea', array('required' => false)), array('orientation', 'choice', array('choices' => array('left' => $translator->trans('feature_left_choice', array(), 'SonataMediaBundle'), 'right' => $translator->trans('feature_right_choice', array(), 'SonataMediaBundle')))), array('context', 'choice', array('required' => true, 'choices' => $contextChoices)), array('format', 'choice', array('required' => count($formatChoices) > 0, 'choices' => $formatChoices)), array($this->getMediaBuilder($formMapper), null, array()))));
}
示例4: buildEditForm
/**
* {@inheritdoc}
*/
public function buildEditForm(FormMapper $formMapper, BlockInterface $block)
{
if (!$block->getSetting('mediaId') instanceof MediaInterface) {
$this->load($block);
}
$formatChoices = $this->getFormatChoices($block->getSetting('mediaId'));
$keys[] = array('title', 'text', array('required' => false));
$keys[] = array($this->getMediaBuilder($formMapper), null, array());
$keys[] = array('format', 'choice', array('required' => count($formatChoices) > 0, 'choices' => $formatChoices));
if ($this->getTemplates()) {
$keys[] = array('template', 'choice', array('choices' => $this->getTemplates()));
}
$formMapper->add('settings', 'sonata_type_immutable_array', array('keys' => $keys, 'attr' => array('class' => 'bruery-immutable-container')));
}
示例5: preUpdate
/**
* {@inheritdoc}
*/
public function preUpdate(BlockInterface $block)
{
$block->setSetting('galleryId', is_object($block->getSetting('galleryId')) ? $block->getSetting('galleryId')->getId() : null);
}
示例6: load
/**
* {@inheritdoc}
*/
public function load(BlockInterface $block)
{
if (is_numeric($block->getSetting('pageId', null))) {
$cmsManager = $this->cmsManagerSelector->retrieve();
$site = $block->getPage()->getSite();
$block->setSetting('pageId', $cmsManager->getPage($site, $block->getSetting('pageId')));
}
}
示例7: resolveIds
/**
* @param BlockInterface $block
*/
private function resolveIds(BlockInterface $block)
{
$block->setSetting('collectionId', is_object($block->getSetting('collectionId')) ? $block->getSetting('collectionId')->getId() : null);
}
示例8: buildEditForm
/**
* {@inheritdoc}
*/
public function buildEditForm(FormMapper $formMapper, BlockInterface $block)
{
$formatChoices = $this->getFormatChoices($block->getSetting('mediaId'));
$formMapper->add('settings', 'sonata_type_immutable_array', array('keys' => array(array('title', 'text', array('required' => false, 'label' => 'form.label_title')), array('content', 'textarea', array('required' => false, 'label' => 'form.label_content')), array('orientation', 'choice', array('required' => false, 'choices' => array('left' => 'form.label_orientation_left', 'right' => 'form.label_orientation_right'), 'label' => 'form.label_orientation')), array($this->getMediaBuilder($formMapper), null, array()), array('format', 'choice', array('required' => count($formatChoices) > 0, 'choices' => $formatChoices, 'label' => 'form.label_format'))), 'translation_domain' => 'SonataMediaBundle'));
}
示例9: load
/**
* {@inheritdoc}
*/
public function load(BlockInterface $block)
{
foreach ($block->getTranslations() as $trans) {
$sharedBlock = $trans->getSetting('blockId', null);
if (is_int($sharedBlock)) {
$sharedBlock = $this->blockManager->findOneBy(array('id' => $sharedBlock));
}
$trans->setSetting('blockId', $sharedBlock);
}
$sharedBlock = $block->getSetting('blockId', null);
if (is_int($sharedBlock)) {
$sharedBlock = $this->blockManager->findOneBy(array('id' => $sharedBlock));
}
$block->setSetting('blockId', $sharedBlock);
}