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


PHP TableBuilder::setViews方法代码示例

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


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

示例1: guess

 /**
  * Guess the HREF for the views.
  *
  * @param TableBuilder $builder
  */
 public function guess(TableBuilder $builder)
 {
     $views = $builder->getViews();
     foreach ($views as &$view) {
         // Only automate it if not set.
         if (!isset($view['attributes']['href'])) {
             $view['attributes']['href'] = $this->url->to($this->request->path() . '?' . array_get($view, 'prefix') . 'view=' . $view['slug']);
         }
     }
     $builder->setViews($views);
 }
开发者ID:huglester,项目名称:streams-platform,代码行数:16,代码来源:HrefGuesser.php

示例2: defaults

 /**
  * Default table views.
  *
  * @param TableBuilder $builder
  */
 public function defaults(TableBuilder $builder)
 {
     if (!($stream = $builder->getTableStream())) {
         return;
     }
     if ($stream->isTrashable() && !$builder->getViews()) {
         $builder->setViews(['all', 'trash']);
     }
 }
开发者ID:jacksun101,项目名称:streams-platform,代码行数:14,代码来源:ViewDefaults.php

示例3: merge

 /**
  * Merge in registered parameters.
  *
  * @param TableBuilder $builder
  */
 public function merge(TableBuilder $builder)
 {
     $views = $builder->getViews();
     foreach ($views as &$parameters) {
         if ($view = $this->views->get(array_get($parameters, 'view'))) {
             $parameters = array_replace_recursive($view, array_except($parameters, ['view']));
         }
     }
     $builder->setViews($views);
 }
开发者ID:huglester,项目名称:streams-platform,代码行数:15,代码来源:ViewLookup.php

示例4: guess

 /**
  * Guess the text for the views.
  *
  * @param TableBuilder $builder
  */
 public function guess(TableBuilder $builder)
 {
     if (!($module = $this->modules->active())) {
         return;
     }
     $views = $builder->getViews();
     foreach ($views as &$view) {
         // Only automate it if not set.
         if (!isset($view['text'])) {
             $view['text'] = $module->getNamespace('view.' . $view['slug']);
         }
     }
     $builder->setViews($views);
 }
开发者ID:huglester,项目名称:streams-platform,代码行数:19,代码来源:TextGuesser.php

示例5: normalize

 /**
  * Normalize the view input.
  *
  * @param TableBuilder $builder
  */
 public function normalize(TableBuilder $builder)
 {
     $views = $builder->getViews();
     foreach ($views as $slug => &$view) {
         /**
          * If the slug is numeric and the view is
          * a string then treat the string as both the
          * view and the slug. This is OK as long as
          * there are not multiple instances of this
          * input using the same view which is not likely.
          */
         if (is_numeric($slug) && is_string($view)) {
             $view = ['slug' => $view, 'view' => $view];
         }
         /**
          * If the slug is NOT numeric and the view is a
          * string then use the slug as the slug and the
          * view as the view.
          */
         if (!is_numeric($slug) && is_string($view)) {
             $view = ['slug' => $slug, 'view' => $view];
         }
         /**
          * If the slug is not numeric and the view is an
          * array without a slug then use the slug for
          * the slug for the view.
          */
         if (is_array($view) && !isset($view['slug']) && !is_numeric($slug)) {
             $view['slug'] = $slug;
         }
         /**
          * Make sure we have a view property.
          */
         if (is_array($view) && !isset($view['view'])) {
             $view['view'] = $view['slug'];
         }
         /**
          * Make sure some default parameters exist.
          */
         $view['attributes'] = array_get($view, 'attributes', []);
         /**
          * Move the HREF if any to the attributes.
          */
         if (isset($view['href'])) {
             array_set($view['attributes'], 'href', array_pull($view, 'href'));
         }
         /**
          * Move the target if any to the attributes.
          */
         if (isset($view['target'])) {
             array_set($view['attributes'], 'target', array_pull($view, 'target'));
         }
         /**
          * Make sure the HREF is absolute.
          */
         if (isset($view['attributes']['href']) && is_string($view['attributes']['href']) && !starts_with($view['attributes']['href'], 'http')) {
             $view['attributes']['href'] = url($view['attributes']['href']);
         }
     }
     $builder->setViews($views);
 }
开发者ID:jacksun101,项目名称:streams-platform,代码行数:66,代码来源:ViewNormalizer.php


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