當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。