Determine the list of templates to use for rendering the given action.

@skipUpgrade
@param string $action
@return array Template list
166123
public function getTemplatesFor($action)
    {
        $templates = SSViewer::get_templates_by_class(static::class, "_{$action}", __CLASS__);

        return array_merge(
            $templates,
            [
                "Security_{$action}",
                "Security",
                $this->config()->get("template_main"),
                "BlankPage"
            ]
        );
    }
306687
private function describeActions($action = "") {

		if (!empty($action)) {
			$parts = explode('_', $action);
			unset($parts[0]);
			$parts = array_values($parts);

			$act = new \stdClass();

			$act->method = $action;

			switch (count($parts)) {
			case 1:
			case 2:
			case 3:
				$act->name = $parts[0];
			case 2:
			case 3:
				$act->tag = $parts[1];
			case 3:
				$act->priority = intval($parts[2]);
				break;
			}
			if (count($parts) == 1) {
				$act->tag = 'initi';
				$act->priority = 10;
			}

			return $act;

		}
		return null;
	}
325440
protected function getActionPath(string $action): string
    {
        $modelName = $this->getModelName();
        $viewName  = $modelName.ucfirst($action).'.js';

        return resource_path('assets/admin/src/views/'.pluralize($modelName).'/'.$viewName);
    }
87165
public function Link($action = null)
    {
        $curr = Controller::curr();
        if ($this->parentDashboardPage) {
            return Controller::join_links($this->parentDashboardPage->Link(), 'widget', ($this->widget ? $this->widget->ID : null), $action);
        }
        if ($curr != $this) {
            $pageLink = Controller::curr()->Link();
            return Controller::join_links($pageLink, 'widget', ($this->widget ? $this->widget->ID : null), $action);
        }
        
        return Controller::join_links('widget', ($this->widget ? $this->widget->ID : null), $action);
    }
1030788
public function beforeAction($action)
    {
        if (in_array($this->action->id, ['notify', 'return', 'cancel', 'proxy-notification'], true)) {
            Yii::$app->controller->enableCsrfValidation = false;
        }

        return parent::beforeAction($action);
    }
27166
protected function _forward($action)
    {
        $controller = $this->_request->getController();

        $viewPath = 'application/packages/' . str_replace('\\', DIRECTORY_SEPARATOR, $this->_package) . '/views/scripts/' . implode('/', array_slice(explode('\\', $this->_namespace), 1)) . '/';
        $this->_view->setFile($viewPath . $controller . DIRECTORY_SEPARATOR . $action . '.phtml');

        $actionName = $action . 'Action';

        return $this->$actionName();
    }
825505
protected function parseAction($action)
    {
        // No action has been set for this route
        if (is_null($action)) {
            return ['uses' => function () {
                throw new LogicException("Route for [{$this->uri}] has no action.");
            }];
        }

        // The action is a normal Closure instance (callable)
        if (is_callable($action)) {
            return ['uses' => $action];
        }
        // If no "uses" property has been set, we will dig through the array to find a
        // Closure instance within this list. We will set the first Closure we come
        // across into the "uses" property that will get fired off by this route.
        elseif (!isset($action['uses'])) {
            $action['uses'] = $this->findCallable($action);
        }

        if (is_string($action['uses']) && !StringHelper::contains($action['uses'], '@')) {
            throw new UnexpectedValueException('Invalid route action: ' . $action['uses']);
        }

        return $action;
    }
59285
protected function convertToControllerAction($action)
    {
        if (is_string($action)) {
            $action = ['uses' => $action];
        }
        
        // Here we'll merge any group "uses" statement if necessary so that the action
        // has the proper clause for this property. Then we can simply set the name
        // of the controller on the action and return the action array for usage.
        if (! empty($this->groupStack)) {
            $action['uses'] = $this->prependGroupUses($action['uses']);
        }
        
        // Here we will set this controller name on the action array just so we always
        // have a copy of it for reference if we need it. This can be used while we
        // search for a controller name or do some other type of fetch operation.
        $action['controller'] = $action['uses'];
        
        return $action;
    }
1237732
public function getTemplate(Action $action, $format = 'html'): \Twig_Template
    {
        $admin = $action->getAdmin();
        if ($action->getTemplate()) {
            // If the template was specified, do not try to fallback
            return $this->twig->loadTemplate($action->getTemplate());
        }

        // Priority to new template_pattern system:
        if (\count($admin->getTemplatePattern()) > 0) {
            foreach ($admin->getTemplatePattern() as $templatePattern) {
                $template = strtr(
                    $templatePattern,
                    [
                        '{{admin}}' => lcfirst($admin->getCode()),
                        '{{Admin}}' => ucfirst($admin->getCode()),
                        '{{action}}' => lcfirst($action->getCode()),
                        '{{Action}}' => ucfirst($action->getCode()),
                        '{{format}}' => $format,
                    ]
                );
                try {
                    return $this->twig->loadTemplate($template);
                } catch (\Twig_Error_Loader $mainError) {
                    $this->logger->debug("Unable to load template '{$template}': {$mainError->getMessage()}");
                    continue;
                }
            }

            $flattened = implode(', ', $admin->getTemplatePattern());
            throw new \RuntimeException(
                "Unable to resolve any valid template for the template_pattern configuration: {$flattened}"
            );
        }

        $template = "{$action->getCode()}.{$format}.twig";

        $customTemplate = $admin->getController().':'.$template;
        $fallbackTemplate = $admin->getFallbackTemplateDirectory() ?
            $admin->getFallbackTemplateDirectory().':'.$template : null;
        $globalFallbackTemplate = $this->globalFallbackTemplate ? $this->globalFallbackTemplate.':'.$template : null;

        try {
            return $this->twig->loadTemplate($customTemplate);
        } catch (\Twig_Error_Loader $mainError) {
            $nextTemplate = $fallbackTemplate ?: $globalFallbackTemplate;
            $this->logger->notice(
                "Missing template {$customTemplate}, falling back to template {$nextTemplate}",
                [
                    'template' => $customTemplate,
                    'admin' => $admin->getCode(),
                    'action' => $action->getCode(),
                ]
            );
        }

        if ($fallbackTemplate) {
            try {
                return $this->twig->loadTemplate($fallbackTemplate);
            } catch (\Twig_Error_Loader $fallbackError) {
                $this->logger->critical(
                    "Missing template '{$customTemplate}' and fallback template '{$fallbackTemplate}'",
                    [
                        'template' => $customTemplate,
                        'fallbackTemplate' => $fallbackTemplate,
                        'admin' => $admin->getCode(),
                        'action' => $action->getCode(),
                        'error' => $fallbackError,
                    ]
                );
            }

            throw $mainError;
        }

        try {
            return $this->twig->loadTemplate($globalFallbackTemplate);
        } catch (\Twig_Error_Loader $fallbackError) {
            $this->logger->critical(
                "Missing template '{$customTemplate}' and global fallback template '{$globalFallbackTemplate}'",
                [
                    'template' => $customTemplate,
                    'globalFallbackTemplate' => $globalFallbackTemplate,
                    'admin' => $admin->getCode(),
                    'action' => $action->getCode(),
                    'fallbackError' => $fallbackError,
                ]
            );
        }

        throw $mainError;
    }
547166
protected function redirectToAction($action)
    {
        return $this->response->redirect([
            'for' => $this->router->getMatchedRoute()->getName(),
            'action' => $action
        ]);
    }
125908
private function supportsAction($action)
    {
        if (null === $this->getSupportedActions()) {
            return true;
        }

        return in_array($action, $this->getSupportedActions());
    }
371696
private function generatePostParams($action)
  {
    $params = [];

    if (!empty($action->postParams))
    {
      foreach ($action->postParams as $param => $type)
      {
        $params[] = new ParameterGenerator($param, $type);
      }
    }

    return $params;
  }
287438
public function notFound($action = null)
    {
        $methods = array("get", "post", "put", "delete", "ajax", "options", "head", "mobile");
        $route = new Route($methods, '*', $action, 'notFound');
        $this->container->addRoute($route);
        return $route;
    }
991495
public function getRules($action = null){

        $rules = $this->rules;

        if( isset($this->rules[$action]) ){
            $rules = $this->rules[$action];
        }

        return $this->parserValidationRules($rules, $this->id);
    }
807951
public function Link($action = null)
    {
        if ($this->shortcodableclass) {
            return Controller::join_links(
                $this->config()->url_base,
                $this->config()->sc_url_segment,
                'edit',
                $this->shortcodableclass
            );
        }
        return Controller::join_links($this->config()->url_base, $this->config()->sc_url_segment, $action);
    }
342112
public function getViewer($action)
    {
        // Answer Viewer Object (from parent):
        
        if (!$this->isCMSPreview()) {
            return parent::getViewer($action);
        }
        
        // Load Page Requirements (uses theme):
        
        PageController::create(Page::create())->doInit();
        
        // Load Preview Requirements:
        
        Requirements::css('silverware/silverware: admin/client/dist/styles/preview.css');
        
        // Answer Viewer Object (for CMS preview):
        
        return new SSViewer(sprintf('%s\CMSPreview', Component::class));
    }
425371
public function configureActionButtons($action, $object = null)
    {
        $list = parent::configureActionButtons($action, $object);

        if (\in_array($action, ['show', 'delete', 'acl', 'history', 'render'], true)
            && $this->canAccessObject('edit', $object)
            && $this->hasRoute('edit')
        ) {
            $list['edit'] = [
                'template' => $this->getTemplateRegistry()->getTemplate('button_edit'),
            ];
        }

        return $list;
    }