本文整理汇总了PHP中Anomaly\Streams\Platform\Ui\Table\TableBuilder::getButtons方法的典型用法代码示例。如果您正苦于以下问题:PHP TableBuilder::getButtons方法的具体用法?PHP TableBuilder::getButtons怎么用?PHP TableBuilder::getButtons使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Anomaly\Streams\Platform\Ui\Table\TableBuilder
的用法示例。
在下文中一共展示了TableBuilder::getButtons方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: guess
/**
* Guess the HREF for a button.
*
* @param TableBuilder $builder
*/
public function guess(TableBuilder $builder)
{
$buttons = $builder->getButtons();
if (!($section = $this->sections->active())) {
return;
}
if (!($module = $this->modules->active())) {
return;
}
$stream = $builder->getTableStream();
foreach ($buttons as &$button) {
// If we already have an HREF then skip it.
if (isset($button['attributes']['href'])) {
continue;
}
switch (array_get($button, 'button')) {
case 'restore':
$button['attributes']['href'] = $this->url->to('entry/handle/restore/' . $module->getNamespace() . '/' . $stream->getNamespace() . '/' . $stream->getSlug() . '/{entry.id}');
break;
default:
// Determine the HREF based on the button type.
$type = array_get($button, 'segment', array_get($button, 'button'));
if ($type && !str_contains($type, '\\') && !class_exists($type)) {
$button['attributes']['href'] = $section->getHref($type . '/{entry.id}');
}
break;
}
}
$builder->setButtons($buttons);
}
示例2: guess
/**
* Guess the text for a button.
*
* @param TableBuilder $builder
*/
public function guess(TableBuilder $builder)
{
$buttons = $builder->getButtons();
if (!($module = $this->modules->active())) {
return;
}
if (!($stream = $builder->getTableStream())) {
return;
}
foreach ($buttons as &$button) {
if (isset($button['permission'])) {
continue;
}
/**
* Try and guess the permission value.
*/
switch (array_get($button, 'button')) {
case 'edit':
$button['permission'] = $module->getNamespace($stream->getSlug() . '.write');
break;
default:
break;
}
}
$builder->setButtons($buttons);
}
示例3: normalize
/**
* Normalize button input.
*
* @param TableBuilder $builder
*/
public function normalize(TableBuilder $builder)
{
$buttons = $builder->getButtons();
foreach ($buttons as $key => &$button) {
$button = $this->process($key, $button);
}
$builder->setButtons($buttons);
}
示例4: guess
/**
* Guess the HREF for a button.
*
* @param TableBuilder $builder
*/
public function guess(TableBuilder $builder)
{
$buttons = $builder->getButtons();
foreach ($buttons as &$button) {
if (isset($button['permission']) && !$this->authorizer->authorize($button['permission'])) {
$button['enabled'] = false;
}
}
$builder->setButtons($buttons);
}
示例5: merge
/**
* Merge in registered properties.
*
* @param TableBuilder $builder
*/
public function merge(TableBuilder $builder)
{
$buttons = $builder->getButtons();
foreach ($buttons as &$parameters) {
if ($button = $this->buttons->get(array_get($parameters, 'button'))) {
$parameters = array_replace_recursive($button, $parameters);
}
}
$builder->setButtons($buttons);
}
示例6: guess
/**
* Guess the text for a button.
*
* @param TableBuilder $builder
*/
public function guess(TableBuilder $builder)
{
$buttons = $builder->getButtons();
if (!($module = $this->modules->active())) {
return;
}
foreach ($buttons as &$button) {
// Skip if set already.
if (!isset($button['text']) && isset($button['slug'])) {
$button['text'] = $module->getNamespace('button.' . $button['slug']);
}
}
$builder->setButtons($buttons);
}
示例7: build
/**
* Build dropdown items.
*
* @param TableBuilder $builder
*/
public function build(TableBuilder $builder)
{
$buttons = $builder->getButtons();
foreach ($buttons as $key => &$button) {
if ($dropdown = array_get($button, 'parent')) {
foreach ($buttons as &$parent) {
if (array_get($parent, 'button') == $dropdown) {
if (!isset($parent['dropdown'])) {
$parent['dropdown'] = [];
}
$parent['dropdown'][] = $button;
}
}
}
}
$builder->setButtons($buttons);
}
示例8: resolve
/**
* Resolve table views.
*
* @param TableBuilder $builder
*/
public function resolve(TableBuilder $builder)
{
$this->resolver->resolve($builder->getButtons(), compact('builder'));
}