Handle an action on the given {@link GridField}.
@param GridField $gridField Grid Field Reference
@param string $actionName Action identifier, see {@link getActions()}.
@param array $arguments Arguments relevant for this
@param array $data All form data
326512
public function handleAction(GridField $gridField, $actionName, $arguments, $data) {
        if($actionName=='restore-draft-item') {
            if(!DataObject::has_extension($gridField->getModelClass(), Versioned::class)) {
                user_error($gridField->getModelClass().' does not have the Versioned extension', E_USER_ERROR);
                
                return;
            }
            
            $controller=$gridField->getForm()->getController();
            
            if(array_key_exists('RecordID', $arguments) && is_numeric($arguments['RecordID'])) {
                Versioned::set_stage(Versioned::DRAFT);
                
                $record=Versioned::get_latest_version($gridField->getModelClass(), intval($arguments['RecordID']));
                
                //If the record does not exist on either draft or live write to the draft
                $isDeletedFromDraft=(!$record->hasMethod('isOnDraft') ? $record->isOnLiveOnly():!$record->isOnDraft());
                if($isDeletedFromDraft) {
                    $record->writeToStage('Stage');
                    
                    if($record->hasMethod('CMSEditLink')) {
                        //Redirect to the edit screen
                        return $controller->redirect($record->CMSEditLink());
                    }else {
                        return;
                    }
                }
                
                //Resource already exists so this shouldn't have been called
                return $controller->httpError(400, _t('WebbuildersGroup\\GridFieldDeletedItems\\Forms\\GridFieldDeletedRestoreButton.ITEM_ALREADY_EXISTS', 'Item already exists on the draft site'));
            }
            
            //Record ID is missing or not a number
            return $controller->httpError(400, _t('WebbuildersGroup\\GridFieldDeletedItems\\Forms\\GridFieldDeletedRestoreButton.INVALID_ID', 'Invalid Record ID'));
        }
    }
1362205
protected function dispatch($eventName, ActionEvent $event = null)
    {
        if ($event == null) {
            $event = new DefaultActionEvent();
        }

        $this->getDispatcher()->dispatch($eventName, $event);
    }
530525
protected function handle_row_actions( $network, $column_name, $primary ) {

		// Bail if not primary column.
		if ( $primary !== $column_name ) {
			return;
		}

		switch_to_network( $network->id );
		$network_admin_url = network_admin_url();
		$network_home_url  = network_home_url();
		restore_current_network();

		$base_url = add_query_arg( array(
			'page' => 'networks',
			'id'   => $network->id,
		) );

		$actions = array();

		// Edit the network.
		if ( current_user_can( 'edit_network', $network->id ) ) {
			$edit_network_url = add_query_arg( array(
				'action' => 'edit_network',
			), $base_url );

			$actions['edit'] = '<span class="edit"><a href="' . esc_url( $edit_network_url ) . '">' . esc_html__( 'Edit', 'wp-multi-network' ) . '</a></span>';
		}

		// Visit the network dashboard.
		if ( current_user_can( 'manage_networks' ) ) {
			$actions['network_admin'] = '<span><a href="' . esc_url( $network_admin_url ) . '">' . esc_html__( 'Dashboard', 'wp-multi-network' ) . '</a></span>';
		}

		// Visit the network main site.
		$actions['visit'] = '<span><a href="' . esc_url( $network_home_url ) . '">' . esc_html__( 'Visit', 'wp-multi-network' ) . '</a></span>';

		// Delete the network.
		if ( $this->can_delete( $network ) ) {
			$delete_network_url = wp_nonce_url( add_query_arg( array(
				'action' => 'delete_network',
			), $base_url ) );

			$actions['delete'] = '<span class="delete"><a href="' . esc_url( $delete_network_url ) . '">' . esc_html__( 'Delete', 'wp-multi-network' ) . '</a></span>';
		}

		/**
		 * Filters the networks list table row action links.
		 *
		 * @since 2.0.0
		 *
		 * @param array  Action links as $slug => $link_markup pairs.
		 * @param int    The current network ID.
		 * @param string The current network name.
		 */
		$actions = apply_filters( 'manage_networks_action_links', array_filter( $actions ), $network->id, $network->sitename );

		return $this->row_actions( $actions );
	}
95951
public function handleEvent(ActionEvent $event)
    {
        if (!$this->scopeDeterminator->currentScopeIsBackend()) {
            return;
        }

        $environment = $event->getEnvironment();

        if (null === ($serializedId = $this->getModelId($environment))) {
            return;
        }

        $operation = $this->getOperation($event->getAction(), $environment);
        if (!($operation instanceof ToggleCommandInterface)) {
            return;
        }

        if (false === $this->checkPermission($event)) {
            $event->stopPropagation();

            return;
        }

        $this->process($environment, $operation, $serializedId);
    }
600670
public function getRestoreAction($gridField, $record, $columnName)
    {
        $canRestoreToDraft = $record->canRestoreToDraft();

        if ($canRestoreToDraft) {
            $restoreToRoot = RestoreAction::shouldRestoreToRoot($record);

            $title = $restoreToRoot
                ? _t('SilverStripe\\Versioned\\RestoreAction.RESTORE_TO_ROOT', 'Restore to draft at top level')
                : _t('SilverStripe\\Versioned\\RestoreAction.RESTORE', 'Restore to draft');
            $description = $restoreToRoot
                ? _t('SilverStripe\\Versioned\\RestoreAction.RESTORE_TO_ROOT_DESC', 'Restore the archived version to draft as a top level item')
                : _t('SilverStripe\\Versioned\\RestoreAction.RESTORE_DESC', 'Restore the archived version to draft');

            $field = GridField_FormAction::create(
                $gridField,
                'Restore' . $record->ID,
                false,
                "restore",
                ['RecordID' => $record->ID]
            )
                ->addExtraClass('btn btn--no-text btn--icon-md font-icon-back-in-time grid-field__icon-action action-menu--handled action-restore')
                ->setAttribute('classNames', 'font-icon-back-in-time action-restore')
                ->setAttribute('data-to-root', $restoreToRoot)
                ->setDescription($description)
                ->setAttribute('aria-label', $title);
        }

        return isset($field) ? $field : null;
    }
223562
public function handleAction(ActionEvent $event)
    {
        if (!$this->scopeDeterminator->currentScopeIsBackend()) {
            return;
        }

        if ('clear-clipboard' === ($actionName = $event->getAction()->getName())) {
            $this->clearClipboard($event);
        }

        if (false === $this->checkPermission($event)) {
            $this->clearClipboard($event, false);

            $event->stopPropagation();

            return;
        }

        if ('create' === $actionName
            || 'cut' === $actionName
            || 'copy' === $actionName
            || 'deepcopy' === $actionName
        ) {
            $this->addToClipboard($event);
        }
    }
671364
private function addAction($actionName)
    {
        $template         = $this->templates[$actionName];
        $command          = preg_filter('/^/', '    ', explode(PHP_EOL, strtr($template, ['$actionName' => $actionName])));
        $command          = array_filter($command, function($var){return strlen(trim($var));});
        $command          = implode(PHP_EOL, $command);
        $this->commands[] = $command;
    }
956837
function(action, triggerValue) {
      var field = this.getFieldByName(action.name);
      if( YAHOO.lang.isFunction(field[action.action]) ) {
         field[action.action].call(field);
      }
      else if( YAHOO.lang.isFunction(action.action) ) {
         action.action.call(field, triggerValue);
      }
      else {
         throw new Error("action "+action.action+" is not a valid action for field "+action.name);
      }
   }
1042639
public function getAction($name) {
        if(isset($this->actions[$name])) {
            return $this->actions[$name];
        } else {
            throw new InvalidArgumentException('Action does not exist: ' . $name);
        }
    }
152649
public function renderActionsRow($actions)
    {
        /* @var $rowPlugin     \SxBootstrap\View\Helper\Bootstrap\Form\Actions */
        /* @var $elementPlugin \SxBootstrap\View\Helper\Bootstrap\Form\Element */
        $rowPlugin     = $this->getView()->plugin('sxb_form_actions');
        $rowPlugin     = $rowPlugin();
        $elementPlugin = $this->getView()->plugin('sxb_form_element');

        if ($actions instanceof ElementInterface) {
            return $rowPlugin->addContent($elementPlugin($actions));
        }

        if (!is_array($actions)) {
            throw new Exception\RuntimeException(
                'Invalid actions type supplied'
            );
        }

        foreach ($actions as $action) {
            $rowPlugin->addContent($elementPlugin($action));
        }

        return $rowPlugin;
    }
467700
public function handleAction(ActionEvent $event)
    {
        if (!$this->scopeDeterminator->currentScopeIsBackend()) {
            return;
        }

        $this->checkLanguage($event->getEnvironment(), 'create' === $event->getAction()->getName());
    }
285051
public function handleAction(\GridField $gridField, $actionName, $arguments, $data) {
        if ($actionName == 'toggle-active') {
            $item = $gridField->getList()->byID($arguments['RecordID']);
            if (!$item) {
                return;
            }

            if ($item->getField('Active')) {
                $item->setField('Active', 0);
            } else {
                $item->setField('Active', 1);
            }
            $item->write();
        }
    }
330001
protected function resolveDatatableAction($actions, $row, $element)
    {
        if (!$element instanceof Closure) {
            return false;
        }
        $action = call_user_func($element, $row);
        if (empty($action)) {
            return false;
        }
        $url   = handles(array_get($action, 'url', '#'));
        $title = array_get($action, 'title');
        $link  = app('html')->link($url, $title, array_get($action, 'attributes', []));
        ($actions instanceof Collection) ? $actions->push($link) : array_push($actions, $link);
        return $actions;
    }
1367515
public function handleAction(GridField $gridField, $actionName, $arguments, $data)
    {
        $state = $gridField->State->GridFieldSortableRows;
        if (!is_bool($state->sortableToggle)) {
            $state->sortableToggle = false;
        } else if ($state->sortableToggle == true) {
            $gridField->getConfig()->removeComponentsByType(GridFieldFilterHeader::class);
            $gridField->getConfig()->removeComponentsByType(GridFieldSortableHeader::class);
        }


        if ($actionName == 'savegridrowsort') {
            return $this->saveGridRowSort($gridField, $data);
        } else if ($actionName == 'sorttopage') {
            return $this->sortToPage($gridField, $data);
        }
    }
330788
protected void fireActionPerformed(ActionEvent event) {
    Object[] listeners = listenerList.getListenerList();
    for(int i = listeners.length - 2; i >= 0; i -= 2) {
      if(listeners[i] == ActionListener.class) {
        ((ActionListener) listeners[i + 1]).actionPerformed(event);
      }
    }
  }
1220529
function(actionName, event){
        var action = this.action[actionName];

        if (action)
          action.call(this, event);

        /** @cut */ if (!action)
        /** @cut */   basis.dev.warn('template call `' + actionName + '` action, but it isn\'t defined in action list');
      }
1229502
public function execute(ResourceNode $resourceNode, string $actionName, array $options = [], array $content = null, array $files = null): Response
    {
        $resourceAction = $this->get($resourceNode, $actionName);
        $resource = $this->resourceManager->getResourceFromNode($resourceNode);

        /** @var ResourceActionEvent $event */
        $event = $this->dispatcher->dispatch(
            static::eventName($actionName, $resourceAction->getResourceType()),
            ResourceActionEvent::class,
            [$resource, $options, $content, $files, $resourceNode]
        );

        return $event->getResponse();
    }