コード例 #1
0
 /**
  * @param array $queryParams
  * @param array|object|null $meta
  * @return Link
  */
 public function current(array $queryParams = [], $meta = null)
 {
     $url = $this->generator->current();
     if ($queryParams) {
         $url .= '?' . http_build_query($queryParams);
     }
     return new Link($url, $meta, true);
 }
コード例 #2
0
 /**
  * Build documentation URL.
  *
  * @param  array  $documentation
  *
  * @return array
  */
 protected function buildDocumentationUrl(array $documentation)
 {
     $current = $this->request->segment(2);
     foreach ($documentation as $doc) {
         $code = $doc->getCode();
         if ($code !== $current && $this->foundation->is('app::docs*')) {
             $doc->setURL(strtr($this->urlGenerator->current(), [$current => $code]));
         }
     }
     return $documentation;
 }
コード例 #3
0
ファイル: Menu.php プロジェクト: irinadorko/html-1
 /**
  * Creates a new menu.
  *
  * A menu will be typically created from the Menu generator class through
  * the Menu facade (Menu::make).
  *
  * @param Url $url
  * @param Theme $theme
  * @param $items
  */
 public function __construct(URL $url, Theme $theme, $items)
 {
     $this->url = $url;
     $this->theme = $theme;
     $this->items = $items;
     $this->activeUrl = $this->url->current();
     $this->baseUrl = $this->url->to('');
 }
コード例 #4
0
ファイル: Html.php プロジェクト: huglester/streams-platform
 /**
  * Get the form action from the options.
  *
  * @param array $options
  *
  * @return string
  */
 protected function getAction(array $options)
 {
     // We will also check for a "route" or "action" parameter on the array so that
     // developers can easily specify a route or controller action when creating
     // a form providing a convenient interface for creating the form actions.
     if (isset($options['url'])) {
         return $this->getUrlAction($options['url']);
     }
     if (isset($options['route'])) {
         return $this->getRouteAction($options['route']);
     } elseif (isset($options['action'])) {
         return $this->getControllerAction($options['action']);
     }
     return $this->url->current();
 }
コード例 #5
0
ファイル: FormBuilder.php プロジェクト: ARCANEDEV/LaravelHtml
 /**
  * Get the form action from the options.
  *
  * @param  array  $options
  *
  * @return string
  */
 private function getAction(array $options)
 {
     // We will also check for a "route" or "action" parameter on the array so that
     // developers can easily specify a route or controller action when creating
     // a form providing a convenient interface for creating the form actions.
     if (isset($options['url'])) {
         return $this->getUrlAction($options['url']);
     } elseif (isset($options['route'])) {
         return $this->getRouteAction($options['route']);
     } elseif (isset($options['action'])) {
         // If an action is available, we are attempting to open a form to a controller
         // action route. So, we will use the URL generator to get the path to these
         // actions and return them from the method. Otherwise, we'll use current.
         return $this->getControllerAction($options['action']);
     }
     return $this->url->current();
 }
コード例 #6
0
ファイル: Metadata.php プロジェクト: arrounded/metadata
 /**
  * Renders the metadata.
  *
  * @param array $attributes
  *
  * @return string
  */
 public function render(array $attributes = [])
 {
     $html = '';
     // Add some default options
     $attributes = array_merge(['card' => 'summary', 'site' => $this->project, 'url' => $this->url->current()], $this->metadata, $attributes);
     // Format URLs if provided
     $image = array_get($attributes, 'image');
     if (!file_exists($this->publicFolder . $image) || strpos($image, 'placeholder') !== false) {
         $image = $this->getPlaceholderIllustration();
     }
     $attributes['image'] = $this->url->asset($image);
     // Get Twitter equivalents
     $twitterProperties = ['name' => 'title', 'image' => 'image:src'];
     // Append attributes
     foreach ($attributes as $name => $value) {
         $twitter = array_get($twitterProperties, $name, $name);
         $html .= $this->getWrapper($twitter, $name, $value) . PHP_EOL;
     }
     return $html;
 }
コード例 #7
0
 /**
  * Get the current URL for the request.
  *
  * @return string
  */
 public function current()
 {
     return $this->url->current();
 }