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


PHP ControllerResolverInterface::getArguments方法代码示例

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


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

示例1: getTitle

 /**
  * {@inheritdoc}
  */
 public function getTitle(Request $request, Route $route)
 {
     $route_title = NULL;
     // A dynamic title takes priority. Route::getDefault() returns NULL if the
     // named default is not set.  By testing the value directly, we also avoid
     // trying to use empty values.
     if ($callback = $route->getDefault('_title_callback')) {
         $callable = $this->controllerResolver->getControllerFromDefinition($callback);
         $arguments = $this->controllerResolver->getArguments($request, $callable);
         $route_title = call_user_func_array($callable, $arguments);
     } elseif ($title = $route->getDefault('_title')) {
         $options = array();
         if ($context = $route->getDefault('_title_context')) {
             $options['context'] = $context;
         }
         $args = array();
         if ($raw_parameters = $request->attributes->get('_raw_variables')) {
             foreach ($raw_parameters->all() as $key => $value) {
                 $args['@' . $key] = $value;
                 $args['%' . $key] = $value;
             }
         }
         if ($title_arguments = $route->getDefault('_title_arguments')) {
             $args = array_merge($args, (array) $title_arguments);
         }
         // Fall back to a static string from the route.
         $route_title = $this->t($title, $args, $options);
     }
     return $route_title;
 }
开发者ID:ddrozdik,项目名称:dmaps,代码行数:33,代码来源:TitleResolver.php

示例2: getContentResult

 /**
  * Returns the result of invoking the sub-controller.
  *
  * @param \Symfony\Component\HttpFoundation\Request $request
  *   The request object.
  * @param mixed $controller_definition
  *   A controller definition string, or a callable object/closure.
  *
  * @return mixed
  *   The result of invoking the controller. Render arrays, strings, HtmlPage,
  *   and HtmlFragment objects are possible.
  */
 public function getContentResult(Request $request, $controller_definition)
 {
     if ($controller_definition instanceof \Closure) {
         $callable = $controller_definition;
     } else {
         $callable = $this->controllerResolver->getControllerFromDefinition($controller_definition);
     }
     $arguments = $this->controllerResolver->getArguments($request, $callable);
     $page_content = call_user_func_array($callable, $arguments);
     return $page_content;
 }
开发者ID:davidsoloman,项目名称:drupalconsole.com,代码行数:23,代码来源:AjaxController.php

示例3: getTitle

 /**
  * {@inheritdoc}
  */
 public function getTitle(LocalTaskInterface $local_task)
 {
     $controller = array($local_task, 'getTitle');
     $request = $this->requestStack->getCurrentRequest();
     $arguments = $this->controllerResolver->getArguments($request, $controller);
     return call_user_func_array($controller, $arguments);
 }
开发者ID:aWEBoLabs,项目名称:taxi,代码行数:10,代码来源:LocalTaskManager.php

示例4: getContentResult

 /**
  * Invokes the form and returns the result.
  *
  * @param \Symfony\Component\HttpFoundation\Request $request
  *   The request object.
  *
  * @return array
  *   The render array that results from invoking the controller.
  */
 public function getContentResult(Request $request)
 {
     $form_object = $this->getFormObject($request, $this->formDefinition);
     // Add the form and form_state to trick the getArguments method of the
     // controller resolver.
     $form_state = array();
     $request->attributes->set('form', array());
     $request->attributes->set('form_state', $form_state);
     $args = $this->controllerResolver->getArguments($request, array($form_object, 'buildForm'));
     $request->attributes->remove('form');
     $request->attributes->remove('form_state');
     // Remove $form and $form_state from the arguments, and re-index them.
     unset($args[0], $args[1]);
     $form_state['build_info']['args'] = array_values($args);
     return $this->formBuilder->buildForm($form_object, $form_state);
 }
开发者ID:alnutile,项目名称:drunatra,代码行数:25,代码来源:FormController.php

示例5: getContentResult

 /**
  * Invokes the form and returns the result.
  *
  * @param \Symfony\Component\HttpFoundation\Request $request
  *   The request object.
  * @param \Drupal\Core\Routing\RouteMatchInterface $route_match
  *   The route match.
  *
  * @return array
  *   The render array that results from invoking the controller.
  */
 public function getContentResult(Request $request, RouteMatchInterface $route_match)
 {
     $form_arg = $this->getFormArgument($route_match);
     $form_object = $this->getFormObject($route_match, $form_arg);
     // Add the form and form_state to trick the getArguments method of the
     // controller resolver.
     $form_state = new FormState();
     $request->attributes->set('form', []);
     $request->attributes->set('form_state', $form_state);
     $args = $this->controllerResolver->getArguments($request, [$form_object, 'buildForm']);
     $request->attributes->remove('form');
     $request->attributes->remove('form_state');
     // Remove $form and $form_state from the arguments, and re-index them.
     unset($args[0], $args[1]);
     $form_state->addBuildInfo('args', array_values($args));
     return $this->formBuilder->buildForm($form_object, $form_state);
 }
开发者ID:318io,项目名称:318-io,代码行数:28,代码来源:FormController.php

示例6: onController

 /**
  * Ensures bubbleable metadata from early rendering is not lost.
  *
  * @param \Symfony\Component\HttpKernel\Event\FilterControllerEvent $event
  *   The controller event.
  */
 public function onController(FilterControllerEvent $event)
 {
     $controller = $event->getController();
     // See \Symfony\Component\HttpKernel\HttpKernel::handleRaw().
     $arguments = $this->controllerResolver->getArguments($event->getRequest(), $controller);
     $event->setController(function () use($controller, $arguments) {
         return $this->wrapControllerExecutionInRenderContext($controller, $arguments);
     });
 }
开发者ID:aWEBoLabs,项目名称:taxi,代码行数:15,代码来源:EarlyRenderingControllerWrapperSubscriber.php


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