本文整理汇总了PHP中Anomaly\Streams\Platform\Ui\Table\TableBuilder::getViews方法的典型用法代码示例。如果您正苦于以下问题:PHP TableBuilder::getViews方法的具体用法?PHP TableBuilder::getViews怎么用?PHP TableBuilder::getViews使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Anomaly\Streams\Platform\Ui\Table\TableBuilder
的用法示例。
在下文中一共展示了TableBuilder::getViews方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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);
}
示例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']);
}
}
示例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);
}
示例4: guess
/**
* Guess the query handler 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['query'])) {
if (class_exists($class = $this->guessClass($builder, $view))) {
$view['query'] = $class . '@handle';
}
}
}
$builder->setViews($views);
}
示例5: 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);
}
示例6: 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);
}
示例7: resolve
/**
* Resolve table views.
*
* @param TableBuilder $builder
*/
public function resolve(TableBuilder $builder)
{
$this->resolver->resolve($builder->getViews(), compact('builder'));
}