本文整理汇总了PHP中Anomaly\Streams\Platform\Ui\Table\TableBuilder::setActions方法的典型用法代码示例。如果您正苦于以下问题:PHP TableBuilder::setActions方法的具体用法?PHP TableBuilder::setActions怎么用?PHP TableBuilder::setActions使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Anomaly\Streams\Platform\Ui\Table\TableBuilder
的用法示例。
在下文中一共展示了TableBuilder::setActions方法的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: handle
/**
* Handle the command.
*
* @param Request $request
* @param Container $container
*/
public function handle(Request $request, ViewHandler $handler)
{
$table = $this->builder->getTable();
$options = $table->getOptions();
$views = $table->getViews();
if ($views->active()) {
return;
}
if ($view = $views->findBySlug($request->get($options->get('prefix') . 'view'))) {
$view->setActive(true);
}
if (!$view && ($view = $views->first())) {
$view->setActive(true);
}
// Nothing to do.
if (!$view) {
return;
}
// Set columns from active view.
if (($columns = $view->getColumns()) !== null) {
$this->builder->setColumns($columns);
}
// Set buttons from active view.
if (($buttons = $view->getButtons()) !== null) {
$this->builder->setButtons($buttons);
}
// Set actions from active view.
if (($actions = $view->getActions()) !== null) {
$this->builder->setActions($actions);
}
$handler->handle($this->builder, $view);
}
示例2: guess
/**
* Guess the action text.
*
* @param TableBuilder $builder
*/
public function guess(TableBuilder $builder)
{
$actions = $builder->getActions();
$stream = $builder->getTableStream();
if (!($module = $this->modules->active())) {
return;
}
$section = $this->controlPanel->getControlPanelActiveSection();
foreach ($actions as &$action) {
/*
* Nothing to do if set already.
*/
if (isset($action['permission'])) {
continue;
}
/*
* Try and guess the permission.
*/
if ($stream) {
$action['permission'] = $module->getNamespace($stream->getSlug() . '.' . $action['slug']);
} elseif ($section) {
$action['permission'] = $module->getNamespace($section->getSlug() . '.' . $action['slug']);
}
}
$builder->setActions($actions);
}
示例3: normalize
/**
* Normalize action input.
*
* @param TableBuilder $builder
*/
public function normalize(TableBuilder $builder)
{
$actions = $builder->getActions();
$prefix = $builder->getTableOption('prefix');
foreach ($actions as $slug => &$action) {
$action = $this->process($prefix, $slug, $action);
}
$builder->setActions($actions);
}
示例4: guess
/**
* Guess the action text.
*
* @param TableBuilder $builder
*/
public function guess(TableBuilder $builder)
{
$actions = $builder->getActions();
if (!($module = $this->modules->active())) {
return;
}
foreach ($actions as &$action) {
// Only if it's not already set.
if (!isset($action['text'])) {
$action['text'] = $module->getNamespace('button.' . $action['slug']);
}
}
$builder->setActions($actions);
}
示例5: merge
/**
* Merge in registered parameters.
*
* @param TableBuilder $builder
*/
public function merge(TableBuilder $builder)
{
$actions = $builder->getActions();
foreach ($actions as &$parameters) {
$action = $original = array_pull($parameters, 'action');
if ($action && ($action = $this->actions->get($action))) {
$parameters = array_replace_recursive($action, array_except($parameters, 'action'));
}
$button = array_get($parameters, 'button', $original);
if ($button && ($button = $this->buttons->get($button))) {
$parameters = array_replace_recursive($button, array_except($parameters, 'button'));
}
}
$builder->setActions($actions);
}
示例6: build
/**
* Build dropdown items.
*
* @param TableBuilder $builder
*/
public function build(TableBuilder $builder)
{
$actions = $builder->getActions();
foreach ($actions as $key => &$action) {
if ($dropdown = array_get($action, 'parent')) {
foreach ($actions as &$parent) {
if (array_get($parent, 'slug') == $dropdown) {
if (!isset($parent['dropdown'])) {
$parent['dropdown'] = [];
}
$parent['dropdown'][] = $action;
}
}
}
}
$builder->setActions($actions);
}
示例7: parse
/**
* Parse the table buttons.
*
* @param TableBuilder $builder
*/
public function parse(TableBuilder $builder)
{
$builder->setActions($this->parser->parse($builder->getActions()));
}
示例8: evaluate
/**
* Evaluate the table actions.
*
* @param TableBuilder $builder
*/
public function evaluate(TableBuilder $builder)
{
$builder->setActions($this->evaluator->evaluate($builder->getActions(), compact('builder')));
}
示例9: predict
/**
* Predict the presence of of the sortable action.
*
* @param TableBuilder $builder
*/
public function predict(TableBuilder $builder)
{
if ($builder->getTableOption('sortable')) {
$builder->setActions(array_merge(['reorder'], $builder->getActions()));
}
}