当前位置: 首页>>代码示例>>PHP>>正文


PHP BlockContextInterface::getSetting方法代码示例

本文整理汇总了PHP中Sonata\BlockBundle\Block\BlockContextInterface::getSetting方法的典型用法代码示例。如果您正苦于以下问题:PHP BlockContextInterface::getSetting方法的具体用法?PHP BlockContextInterface::getSetting怎么用?PHP BlockContextInterface::getSetting使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Sonata\BlockBundle\Block\BlockContextInterface的用法示例。


在下文中一共展示了BlockContextInterface::getSetting方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: execute

 /**
  * {@inheritdoc}
  */
 public function execute(BlockContextInterface $blockContext, Response $response = null)
 {
     $context = $blockContext->getBlock()->getSetting('context');
     $criteria = array('mode' => $blockContext->getSetting('mode'), 'context' => $context);
     $order = array($blockContext->getSetting('order') => $blockContext->getSetting('sort'));
     return $this->renderResponse($blockContext->getTemplate(), array('context' => $blockContext, 'settings' => $blockContext->getSettings(), 'block' => $blockContext->getBlock(), 'pager' => $this->galleryManager->getPager($criteria, 1, $blockContext->getSetting('number'), $order)), $response);
 }
开发者ID:nicolasricci,项目名称:SonataMediaBundle,代码行数:10,代码来源:GalleryListBlockService.php

示例2: execute

 /**
  * {@inheritdoc}
  */
 public function execute(BlockContextInterface $blockContext, Response $response = null)
 {
     $criteria = array();
     if ('admin' !== $blockContext->getSetting('mode')) {
         $criteria['customer'] = $this->customerManager->findOneBy(array('user' => $this->securityContext->getToken()->getUser()));
     }
     return $this->renderPrivateResponse($blockContext->getTemplate(), array('context' => $blockContext, 'settings' => $blockContext->getSettings(), 'block' => $blockContext->getBlock(), 'orders' => $this->orderManager->findBy($criteria, array('createdAt' => 'DESC'), $blockContext->getSetting('number'))), $response);
 }
开发者ID:johnulist,项目名称:ecommerce-1,代码行数:11,代码来源:RecentOrdersBlockService.php

示例3: execute

 /**
  * {@inheritdoc}
  */
 public function execute(BlockContextInterface $blockContext, Response $response = null)
 {
     $criteria = array('mode' => $blockContext->getSetting('mode'));
     $userManager = $this->container->get('fos_user.user_manager');
     $user = $userManager->findUserByUsername($this->container->get('security.context')->getToken()->getUser());
     $mapbookmarks = null;
     $ecosystems = $this->em->getRepository('YorkuJuturnaBundle:EcoSystemService')->findBy(array(), array("id" => "ASC"));
     if ($user && $user != 'anon.') {
         $mapbookmarks = $this->em->getRepository('Map2uCoreBundle:MapBookmark')->findBy(array("userId" => $user->getId()), array("seq" => "ASC"));
     }
     $wellbeingdomains = $this->em->getRepository('YorkuJuturnaBundle:HumanWellBeingDomain')->findBy(array(), array("id" => "ASC"));
     $parameters = array('context' => $blockContext, 'settings' => $blockContext->getSettings(), 'ecosystems' => $ecosystems, 'wellbeingdomains' => $wellbeingdomains, 'mapbookmarks' => $mapbookmarks, 'block' => $blockContext->getBlock());
     if ($blockContext->getSetting('mode') === 'admin') {
         return $this->renderPrivateResponse($blockContext->getTemplate(), $parameters, $response);
     }
     return $this->renderResponse($blockContext->getTemplate(), $parameters, $response);
 }
开发者ID:josephzhao,项目名称:cvcbrowser,代码行数:20,代码来源:FixedTopmenuBlockService.php

示例4: execute

 /**
  * {@inheritdoc}
  */
 public function execute(BlockContextInterface $blockContext, Response $response = null)
 {
     $criteria = array('mode' => $blockContext->getSetting('mode'));
     $parameters = array('context' => $blockContext, 'settings' => $blockContext->getSettings(), 'block' => $blockContext->getBlock(), 'pager' => $this->manager->getPager($criteria, 1, $blockContext->getSetting('number')), 'admin_pool' => $this->adminPool);
     if ($blockContext->getSetting('mode') === 'admin') {
         return $this->renderPrivateResponse($blockContext->getTemplate(), $parameters, $response);
     }
     return $this->renderResponse($blockContext->getTemplate(), $parameters, $response);
 }
开发者ID:kinkinweb,项目名称:lhvb,代码行数:12,代码来源:RecentCommentsBlockService.php

示例5: execute

 /**
  * {@inheritdoc}
  */
 public function execute(BlockContextInterface $blockContext, Response $response = null)
 {
     $token = $this->securityContext->getToken();
     if (!$token) {
         return new Response();
     }
     $subject = $this->actionManager->findOrCreateComponent($token->getUser(), $token->getUser()->getId());
     $entries = $this->timelineManager->getTimeline($subject, array('page' => 1, 'max_per_page' => $blockContext->getSetting('max_per_page'), 'type' => TimelineInterface::TYPE_TIMELINE, 'context' => $blockContext->getSetting('context'), 'filter' => $blockContext->getSetting('filter'), 'group_by_action' => $blockContext->getSetting('group_by_action'), 'paginate' => $blockContext->getSetting('paginate')));
     return $this->renderPrivateResponse($blockContext->getTemplate(), array('context' => $blockContext, 'settings' => $blockContext->getSettings(), 'block' => $blockContext->getBlock(), 'entries' => $entries), $response);
 }
开发者ID:saberyounis,项目名称:Sonata-Project,代码行数:13,代码来源:TimelineBlock.php

示例6: execute

 /**
  * {@inheritdoc}
  */
 public function execute(BlockContextInterface $blockContext, Response $response = null)
 {
     $criteria = array('mode' => $blockContext->getSetting('mode'));
     $indicators = $this->em->getRepository('YorkuJuturnaBundle:Indicator')->findBy(array(), array("id" => "ASC"));
     $parameters = array('context' => $blockContext, 'settings' => $blockContext->getSettings(), 'indicators' => $indicators, 'block' => $blockContext->getBlock());
     if ($blockContext->getSetting('mode') === 'admin') {
         return $this->renderPrivateResponse($blockContext->getTemplate(), $parameters, $response);
     }
     return $this->renderResponse($blockContext->getTemplate(), $parameters, $response);
 }
开发者ID:josephzhao,项目名称:cvcbrowser,代码行数:13,代码来源:IndicatorColumnBlockService.php

示例7: execute

 /**
  * {@inheritdoc}
  */
 public function execute(BlockContextInterface $blockContext, Response $response = null)
 {
     $admin = $this->pool->getAdminByAdminCode($blockContext->getSetting('code'));
     $datagrid = $admin->getDatagrid();
     $filters = $blockContext->getSetting('filters');
     if (!isset($filters['_per_page'])) {
         $filters['_per_page'] = array('value' => $blockContext->getSetting('limit'));
     }
     foreach ($filters as $name => $data) {
         $datagrid->setValue($name, isset($data['type']) ? $data['type'] : null, $data['value']);
     }
     $datagrid->buildPager();
     return $this->renderPrivateResponse($blockContext->getTemplate(), array('block' => $blockContext->getBlock(), 'settings' => $blockContext->getSettings(), 'admin_pool' => $this->pool, 'admin' => $admin, 'pager' => $datagrid->getPager(), 'datagrid' => $datagrid), $response);
 }
开发者ID:0mars,项目名称:SonataAdminBundle,代码行数:17,代码来源:AdminStatsBlockService.php

示例8: execute

 /**
  * {@inheritdoc}
  */
 public function execute(BlockContextInterface $blockContext, Response $response = null)
 {
     try {
         $admin = $this->pool->getAdminByAdminCode($blockContext->getSetting('admin_code'));
     } catch (ServiceNotFoundException $e) {
         throw new \RuntimeException('Unable to find the Admin instance', $e->getCode(), $e);
     }
     if (!$admin instanceof AdminInterface) {
         throw new \RuntimeException('The requested service is not an Admin instance');
     }
     if (!$admin->isGranted('LIST')) {
         throw new AccessDeniedException();
     }
     $pager = $this->searchHandler->search($admin, $blockContext->getSetting('query'), $blockContext->getSetting('page'), $blockContext->getSetting('per_page'));
     return $this->renderPrivateResponse($admin->getTemplate('search_result_block'), array('block' => $blockContext->getBlock(), 'settings' => $blockContext->getSettings(), 'admin_pool' => $this->pool, 'pager' => $pager, 'admin' => $admin), $response);
 }
开发者ID:ronanguilloux,项目名称:SonataAdminBundle,代码行数:19,代码来源:AdminSearchBlockService.php

示例9: execute

 /**
  * {@inheritdoc}
  */
 public function execute(BlockContextInterface $blockContext, Response $response = null)
 {
     $tabs = $blockContext->getSetting('tabs');
     foreach ($tabs as $pos => $tab) {
         $tabs[$pos] = array_merge(array('title' => 'NR Metric', 'reference' => false), $tab);
     }
     return $this->renderResponse('EkinoNewRelicBundle:Block:tabs.html.twig', array('tabs' => $tabs, 'settings' => $blockContext->getSettings(), 'block' => $blockContext->getBlock(), 'context' => $blockContext));
 }
开发者ID:Aerendir,项目名称:EkinoNewRelicBundle,代码行数:11,代码来源:NewRelicTabsBlockService.php

示例10: execute

 /**
  * {@inheritdoc}
  */
 public function execute(BlockContextInterface $blockContext, Response $response = null)
 {
     $revisions = array();
     foreach ($this->auditReader->findRevisionHistory($blockContext->getSetting('limit'), 0) as $revision) {
         $revisions[] = array('revision' => $revision, 'entities' => $this->auditReader->findEntitesChangedAtRevision($revision->getRev()));
     }
     return $this->renderResponse($blockContext->getTemplate(), array('block' => $blockContext->getBlock(), 'settings' => $blockContext->getSettings(), 'revisions' => $revisions), $response);
 }
开发者ID:rmzamora,项目名称:SonataDoctrineORMAdminBundle,代码行数:11,代码来源:AuditBlockService.php

示例11: execute

 /**
  * {@inheritdoc}
  */
 public function execute(BlockContextInterface $blockContext, Response $response = null)
 {
     $product = $blockContext->getSetting('product');
     if (null === $product) {
         return $this->renderResponse($blockContext->getTemplate(), array('context' => $blockContext, 'settings' => $blockContext->getSettings(), 'block' => $blockContext->getBlock(), 'choices' => array(), 'form' => null), $response);
     }
     $fields = $blockContext->getSetting('variations_properties');
     $choices = $this->pool->getProvider($product)->getVariationsChoices($product, $fields);
     $accessor = PropertyAccess::createPropertyAccessor();
     $currentValues = array();
     foreach ($choices as $field => $values) {
         $currentValues[$field] = array_search($accessor->getValue($product, $field), $values);
     }
     $form = $this->formFactory->createBuilder('sonata_product_variation_choices', $currentValues, array('field_options' => $blockContext->getSetting('form_field_options'), 'product' => $product, 'fields' => $fields))->getForm();
     $params = array('context' => $blockContext, 'settings' => $blockContext->getSettings(), 'block' => $blockContext->getBlock(), 'choices' => $choices, 'form' => $form->createView());
     return $this->renderResponse($blockContext->getTemplate(), $params, $response);
 }
开发者ID:Dicoding,项目名称:ecommerce,代码行数:20,代码来源:VariationsFormBlockService.php

示例12: execute

 /**
  * {@inheritdoc}
  */
 public function execute(BlockContextInterface $blockContext, Response $response = null)
 {
     $tweet = $blockContext->getSetting('tweet');
     if (($uriMatched = preg_match(self::TWEET_URL_PATTERN, $tweet)) || preg_match(self::TWEET_ID_PATTERN, $tweet)) {
         // We matched an URL or an ID, we'll need to ask the API
         if (class_exists('Guzzle\\Http\\Client') === false) {
             throw new \RuntimeException('The guzzle http client library is required to call the Twitter API. Make sure to add guzzle/guzzle to your composer.json.');
         }
         // TODO cache API result
         $client = new \Guzzle\Http\Client();
         $client->setConfig(array('curl.options' => array(CURLOPT_CONNECTTIMEOUT_MS => 1000)));
         try {
             $request = $client->get($this->buildUri($uriMatched, $blockContext->getSettings()));
             $apiTweet = json_decode($request->send()->getBody(true), true);
             $tweet = $apiTweet['html'];
         } catch (CurlException $e) {
             // log error
         }
     }
     return $this->renderResponse($blockContext->getTemplate(), array('block' => $blockContext->getBlock(), 'tweet' => $tweet), $response);
 }
开发者ID:sagikazarmark,项目名称:SonataSeoBundle,代码行数:24,代码来源:TwitterEmbedTweetBlockService.php

示例13: execute

 /**
  * {@inheritdoc}
  */
 public function execute(BlockContextInterface $blockContext, Response $response = null)
 {
     if (!$response) {
         $response = new Response();
     }
     if ($blockContext->getBlock()->getEnabled()) {
         $qb = $this->dm->createQueryBuilder();
         $qb->from()->document('AppBundle\\Document\\TalkBlock', 't')->end()->orderBy()->asc()->field('t.publishEndDate');
         if ($maxItems = $blockContext->getSetting('maxItems')) {
             $qb->setMaxResults($maxItems);
         }
         // filter by published
         $talkBlocks = array();
         foreach ($qb->getQuery()->execute() as $document) {
             if ($this->publishWorkflowChecker->isGranted(PublishWorkflowChecker::VIEW_ANONYMOUS_ATTRIBUTE, $document)) {
                 $talkBlocks[] = $document;
             }
         }
         $response = $this->renderResponse($blockContext->getTemplate(), array('block' => $blockContext->getBlock(), 'talkBlocks' => $talkBlocks), $response);
     }
     return $response;
 }
开发者ID:joemoe,项目名称:symfony-cmf-website,代码行数:25,代码来源:EventsBlockService.php

示例14: execute

 /**
  * {@inheritdoc}
  */
 public function execute(BlockContextInterface $blockContext, Response $response = null)
 {
     $builder = $this->container->get('form.factory')->createBuilder('form');
     $form = $builder->add('categories', 'entity', array('label' => 'Categories:', 'class' => 'Map2uCoreBundle:Category', 'required' => false, 'property' => 'name'))->add('tags', 'entity', array('label' => 'Tags:', 'class' => 'Map2uCoreBundle:Tag', 'required' => false, 'property' => 'name'))->add('spatial_file', 'file', array('mapped' => false, 'label' => 'Select upload spatial files:', 'attr' => array("multiple" => "multiple")))->add('upload_file_list', 'choice', array('mapped' => false, 'label' => 'Selected upload files list:', 'attr' => array('size' => "7", "placeholder" => "upload file list!")))->getForm();
     //        $form = $this->createForm();
     //    $userManager = $this->container->get('fos_user.user_manager');
     //    $user = $userManager->findUserByUsername($this->container->get('security.context')
     //            ->getToken() ->getUser());
     //
     //    if ($user && $user != 'anon.') {
     //      $shapefilelist = $this->em->createQuery('SELECT u FROM Map2uCoreBundle:SpatialFile u WHERE  u.userId=' . $user->getId() . ' or u.public=true  order by u.updatedAt DESC')
     //          ->getResult();
     //    }
     //    else {
     //      $shapefilelist = $this->em->createQuery('SELECT u FROM Map2uCoreBundle:SpatialFile u WHERE  u.public=true  order by u.updatedAt DESC')
     //          ->getResult();
     //    }
     $parameters = array('context' => $blockContext, 'form' => $form->createView(), 'settings' => $blockContext->getSettings(), 'filetypes' => array('none' => array('type' => 'none', 'name' => 'Do not know yet'), 'pc' => array('type' => 'tradearea', 'name' => 'Trade Area'), 'cs' => array('type' => 'customer', 'name' => 'Customer'), 'poi' => array('type' => 'poi', 'name' => 'POI'), 'map' => array('type' => 'maps', 'name' => 'Maps')), 'block' => $blockContext->getBlock());
     if ($blockContext->getSetting('mode') === 'admin') {
         return $this->renderPrivateResponse($blockContext->getTemplate(), $parameters, $response);
     }
     return $this->renderResponse($blockContext->getTemplate(), $parameters, $response);
 }
开发者ID:josephzhao,项目名称:map2ucore,代码行数:26,代码来源:UploadSpatialFileBlockService.php

示例15: execute

 /**
  * {@inheritdoc}
  */
 public function execute(BlockContextInterface $blockContext, Response $response = null)
 {
     $settings = $blockContext->getBlock()->getSettings();
     $admin = $this->pool->getAdminByAdminCode($blockContext->getSetting('code'));
     return $this->renderResponse($blockContext->getTemplate(), array('context' => $blockContext, 'block' => $blockContext->getBlock(), 'admin' => $admin, 'settings' => $settings), $response);
 }
开发者ID:bruery,项目名称:platform,代码行数:9,代码来源:UserAuthenticationLogsStatsBlockService.php


注:本文中的Sonata\BlockBundle\Block\BlockContextInterface::getSetting方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。