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


PHP TableBuilder::getFilters方法代码示例

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


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

示例1: normalize

 /**
  * Normalize filter input.
  *
  * @param TableBuilder $builder
  */
 public function normalize(TableBuilder $builder)
 {
     $filters = $builder->getFilters();
     $stream = $builder->getTableStream();
     foreach ($filters as $slug => &$filter) {
         /**
          * If the filter is a string then use
          * it for everything.
          */
         if (is_string($filter) && !str_contains($filter, '/')) {
             $filter = ['slug' => $filter, 'field' => $filter, 'filter' => 'field'];
         }
         /**
          * If the filter is a class string then use
          * it for the filter.
          */
         if (is_string($filter) && str_contains($filter, '/')) {
             $filter = ['slug' => $slug, 'filter' => $filter];
         }
         /**
          * Move the slug into the filter.
          */
         if (!isset($filter['slug'])) {
             $filter['slug'] = $slug;
         }
         /**
          * Move the slug to the filter.
          */
         if (!isset($filter['filter'])) {
             $filter['filter'] = $filter['slug'];
         }
         /**
          * Fallback the field.
          */
         if (!isset($filter['field']) && $stream && $stream->hasAssignment($filter['slug'])) {
             $filter['field'] = $filter['slug'];
         }
         /**
          * If there is no filter type
          * then assume it's the slug.
          */
         if (!isset($filter['filter'])) {
             $filter['filter'] = $filter['slug'];
         }
         /**
          * Set the table's stream.
          */
         if ($stream) {
             $filter['stream'] = $stream;
         }
     }
     $builder->setFilters($filters);
 }
开发者ID:jacksun101,项目名称:streams-platform,代码行数:58,代码来源:FilterNormalizer.php

示例2: guess

 /**
  * Guess some table table filter placeholders.
  *
  * @param TableBuilder $builder
  */
 public function guess(TableBuilder $builder)
 {
     $filters = $builder->getFilters();
     $stream = $builder->getTableStream();
     foreach ($filters as &$filter) {
         // Skip if we already have a placeholder.
         if (isset($filter['placeholder'])) {
             continue;
         }
         // Get the placeholder off the assignment.
         if ($stream && ($assignment = $stream->getAssignment(array_get($filter, 'field')))) {
             /*
              * Always use the field name
              * as the placeholder. Placeholders
              * that are assigned otherwise usually
              * feel out of context:
              *
              * "Choose an option..." in the filter
              * would just be weird.
              */
             $placeholder = $assignment->getFieldName();
             if ($this->translator->has($placeholder)) {
                 $filter['placeholder'] = $placeholder;
             }
         }
         if (!($module = $this->modules->active())) {
             continue;
         }
         $placeholder = $module->getNamespace('field.' . $filter['slug'] . '.placeholder');
         if (!isset($filter['placeholder']) && $this->translator->has($placeholder)) {
             $filter['placeholder'] = $placeholder;
         }
         $placeholder = $module->getNamespace('field.' . $filter['slug'] . '.name');
         if (!isset($filter['placeholder']) && $this->translator->has($placeholder)) {
             $filter['placeholder'] = $placeholder;
         }
         if (!array_get($filter, 'placeholder')) {
             $filter['placeholder'] = $filter['slug'];
         }
         if (!$this->translator->has($filter['placeholder']) && $this->config->get('streams::system.lazy_translations')) {
             $filter['placeholder'] = ucwords($this->string->humanize($filter['placeholder']));
         }
     }
     $builder->setFilters($filters);
 }
开发者ID:huglester,项目名称:streams-platform,代码行数:50,代码来源:PlaceholdersGuesser.php

示例3: resolve

 /**
  * Resolve table views.
  *
  * @param TableBuilder $builder
  */
 public function resolve(TableBuilder $builder)
 {
     $this->resolver->resolve($builder->getFilters(), compact('builder'));
 }
开发者ID:huglester,项目名称:streams-platform,代码行数:9,代码来源:FilterResolver.php


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