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