Generate actions from an array of action definitions

@param array $actions

@return Editbox
964159
public function generateActions(array $actions): Editbox
    {
        foreach ($actions as $action) {

            $action_object = new Action();

            if (empty($action['type'])) {
                $action['type'] = 'context';
            }

            $action_object->setType($action['type']);

            if (! empty($action['text'])) {
                $action_object->setText($action['text']);
            }

            if (! empty($action['href'])) {
                $action_object->setHref($action['href']);
            }

            if (isset($action['ajax'])) {
                $action_object->setAjax($action['ajax']);
            }

            if (! empty($action['icon'])) {
                $action_object->setIcon($action['icon']);
            }

            if (! empty($action['confirm'])) {
                $action_object->setConfirm($action['confirm']);
            }

            $this->addAction($action_object);
        }

        return $this;
    }
1037386
public static function map($actions=array(), $options=array())
    {
        if (empty($actions)) {
            return null;
        }

        $out   = array();
        $count = 0;
        $len   = count($actions);

        foreach ($actions as $label => $mixed) {

            $count++;

            $action = new Item($label, $mixed);

            if ($count == 1) {
                $action->isFirst = true;
            }

            if ($count == $len) {
                $action->isLast = true;
            }

            $out[] = $action;

        }

        return $out;
    }
470909
protected function gatherUpdates($actions)
    {
        collection($actions)
            ->filter(function ($action) {
                return $action instanceof AddColumn
                    || $action instanceof ChangeColumn
                    || $action instanceof RemoveColumn
                    || $action instanceof RenameColumn;
            })
            // We are only concerned with table changes
            ->reject(function ($action) {
                return isset($this->tableCreates[$action->getTable()->getName()]);
            })
            ->each(function ($action) {
                $table = $action->getTable();
                $name = $table->getName();

                if (!isset($this->tableUpdates[$name])) {
                    $this->tableUpdates[$name] = new AlterTable($table);
                }

                $this->tableUpdates[$name]->addAction($action);
            });
    }
1224339
protected function gatherIndexes($actions)
    {
        collection($actions)
            ->filter(function ($action) {
                return $action instanceof AddIndex
                    || $action instanceof DropIndex;
            })
            ->reject(function ($action) {
                // Indexes for new tables are created inline
                // so we don't wan't them here too
                return isset($this->tableCreates[$action->getTable()->getName()]);
            })
            ->each(function ($action) {
                $table = $action->getTable();
                $name = $table->getName();

                if (!isset($this->indexes[$name])) {
                    $this->indexes[$name] = new AlterTable($table);
                }

                $this->indexes[$name]->addAction($action);
            });
    }
211497
protected function setListActions(array $actions)
    {
        $this->parsedListActions = false;

        $this->listActions = $this->mergeActions($this->defaultListActions(), $actions);

        return $this;
    }
715673
protected static function generateFullCapabilities(string $contrName, array $actions): array
    {
        $result = [];

        if (empty($contrName) || empty($actions)) {
            return $result;
        }

        // generate action's full (all) type capabilities
        foreach ($actions as $action) {
            $name = static::generateCapabilityName($contrName, $action);
            $options = [
                'label' => static::generateCapabilityLabel($contrName, $action . '_all'),
                'description' => static::generateCapabilityDescription($contrName, static::humanizeActionName($action))
            ];

            $result[] = new Cap($name, $options);
        }

        return $result;
    }
1163301
function generateActions({ generate, ...actions }) {
  return !generate
    ? actions
    : Object.assign(
        generate.reduce((obj, name) => {
          obj[name] = forwardValue;
          return obj;
        }, {}),
        actions
      );
}
931104
public function remove_quick_edit_action( array $actions, WP_Post $post ) : array {

		if ( $this->cpt->post_type !== $post->post_type ) {
			return $actions;
		}

		unset( $actions['inline'], $actions['inline hide-if-no-js'] );
		return $actions;

	}
723794
protected function compileAction($action)
    {
        if (is_null($action)) {
            return $this->attributes;
        }

        if (is_string($action) || $action instanceof Closure) {
            $action = ['uses' => $action];
        }

        return array_merge($this->attributes, $action);
    }
1251271
public function addAction($action)
    {
        if ($action instanceof AttachmentAction) {
            $this->actions[] = $action;

            return $this;
        } elseif (is_array($action)) {
            $this->actions[] = new AttachmentAction($action);

            return $this;
        }

        throw new InvalidArgumentException('The attachment action must be an instance of jeremykenedy\Slack\AttachmentAction or a keyed array');
    }
100509
public function create(array $parameters) {
        $toolbarItem = new FormToolbarItem($parameters['action']);
        unset($parameters['action']);
        foreach($parameters as $key => $value) {
            $toolbarItem->$key = $value;
        }
        return $toolbarItem;
    }
928855
private function createActionMiddleware($action, array $params){
        $middlewares    = [];

        $middlewares[]  = $this->container->get("core.middleware.action")
            ->setAction($action)
            ->setParams($params)
        ;

        return $middlewares;
    }
943546
public function setActions($actions): self
    {
        $this->clearActions();

        foreach ($actions as $action) {
            $this->addAction($action);
        }

        return $this;
    }
495066
protected function mergeActions(array ...$params)
    {
        $unique = [];
        foreach ($params as $actions) {
            foreach ($actions as $ident => $action) {
                if ($action === '|') {
                    $unique[$ident] = $action;
                    continue;
                }

                $ident = $this->parseActionIdent($ident, $action);
                $action['ident'] = $ident;

                $hasActions = (isset($action['actions']) && is_array($action['actions']));
                if ($hasActions) {
                    $action['actions'] = $this->mergeActions($action['actions']);
                } else {
                    $action['actions'] = [];
                }

                if (isset($unique[$ident])) {
                    if (static::compareActions($action, $unique[$ident])) {
                        if ($hasActions && !!$unique[$ident]['actions']) {
                            $action['actions'] = $this->mergeActions(
                                $unique[$ident]['actions'],
                                $action['actions']
                            );
                            unset($unique[$ident]['actions']);
                        }
                        $unique[$ident] = array_replace($unique[$ident], $action);
                    } else {
                        if ($hasActions && !!$unique[$ident]['actions']) {
                            $unique[$ident]['actions'] = $this->mergeActions(
                                $unique[$ident]['actions'],
                                $action['actions']
                            );
                            unset($action['actions']);
                        }
                        $unique[$ident] = array_replace($action, $unique[$ident]);
                    }
                } else {
                    $unique[$ident] = $action;
                }
            }
        }

        return $unique;
    }
337687
public function setAction($action)
    {
        $this->action = is_string($action) ? $action : $this->$action;
        $this->prepareUrl();

        return $this;
    }
840933
protected function mergeMiddlewareGroup(array $action)
    {
        if (isset($this->groupAttributes['middleware'])) {
            $groupMiddleware = trim($this->groupAttributes['middleware'], '|');

            if (isset($action['middleware'])) {
                $action['middleware'] = $groupMiddleware.'|'.$action['middleware'];
            }
            else {
                $action['middleware'] = $groupMiddleware;
            }
        }

        return $action;
    }
312695
public function set($actions)
    {
        if (! is_array($actions)) {
            $actions = func_get_args();
        }

        $this->clear();

        foreach ($actions as $action) {
            $this->push($action);
        }

        return $this->getDisplay();
    }