Get breadcrumbs for $action.

@param AdminInterface $admin
@param string         $action the name of the action we want to get a
breadcrumbs for

@return mixed array|Traversable the breadcrumbs
178300
public function getBreadcrumbs(AdminInterface $admin, $action)
    {
        $breadcrumbs = [];

        if ($admin->isChild()) {
            return $this->getBreadcrumbs($admin->getParent(), $action);
        }

        $menu = $this->buildBreadcrumbs($admin, $action);

        /* @noinspection PhpAssignmentInConditionInspection */
        do {
            $breadcrumbs[] = $menu;
        } while ($menu = $menu->getParent());

        $breadcrumbs = array_reverse($breadcrumbs);

        array_shift($breadcrumbs);

        return $breadcrumbs;
    }
358815
public function generateUrl(AdminInterface $admin, $action, $params = [])
    {
        $routeName = $this->getRouteName($admin, $action);

        return $this->router->generate($routeName, $params);
    }
143482
protected function getAdmin(ComponentInterface $component, ActionInterface $action = null)
    {
        if ($action && $adminComponent = $action->getComponent('admin_code')) {
            return $this->pool->getAdminByAdminCode($adminComponent);
        }

        try {
            return $this->pool->getAdminByClass($component->getModel());
        } catch (\RuntimeException $e) {
        }

        return false;
    }
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;
    }
968703
public function all($uri, $action = null)
    {
        $verbs = ['GET', 'HEAD', 'POST', 'PUT', 'PATCH', 'DELETE'];

        return $this->addRoute($verbs, $uri, $action);
    }
581289
public function Link($action=null) {
        $link = Controller::join_links(
            $this->stat('url_base', true),
            $this->stat('url_segment', true), // in case we want to change the segment
            '/', // trailing slash needed if $action is null!
            "$action"
        );
        
        $this->extend('updateLink', $link);
        return $link;
    }
758923
public function configureBatchActions(AdminInterface $admin, array $actions)
    {
        /** @var AbstractAdmin $admin */
        if ($admin->hasRoute('edit') && $admin->hasAccess('edit') && $admin->getList()->has('enabled')) {
            $actions['enable'] = [
            ];

            $actions['disable'] = [
            ];
        }

        return $actions;
    }
712615
public function generateAdminEntityPath(
        $admin,
        $entity,
        $actionCode,
        array $parameters = [],
        $referenceType = UrlGeneratorInterface::ABSOLUTE_PATH
    ): string {
        $admin = $this->getAdmin($admin);
        $action = $admin->getAction($actionCode);

        $missingParams = $this->computeMissingRouteParameters($action->getRoute(), $parameters);
        foreach ($missingParams as $missingParam) {
            try {
                $parameters[$missingParam] = $this->accessor->getValue($entity, $missingParam);
            } catch (\Exception $e) {
                try {
                    // Fallback to array syntax
                    $parameters[$missingParam] = $this->accessor->getValue($entity, "[{$missingParam}]");
                } catch (\Exception $e) {
                    $contextParam = $this->router->getContext()->getParameter($missingParam);
                    if (null !== $contextParam) {
                        $parameters[$missingParam] = $contextParam;
                    }
                }
            }
        }

        return $this->router->generate($action->getRouteName(), $parameters, $referenceType);
    }
229113
protected function afterRunInBreadCrumbSupport($action, $view, $method) {
        /**@var Annotation $ann */
        $ann = $method->anns;
        if ($view instanceof View) {
            $breadCrumbs = [];
            $crumb       = $ann->getString('crumb');
            if ($crumb && preg_match('#^([a-z][a-z_\d]*)-(\d+)(\s+.*)?$#i', trim($crumb), $ms)) {
                $sname       = '_wula_bdCbs_' . $ms[1];
                $breadCrumbs = sess_get($sname, []);
                $level       = intval($ms[2]);
                $data        = $view->getData();
                $title       = isset($data['crumbTitle']) && $data['crumbTitle'] ? $data['crumbTitle'] : false;
                if (!$title && isset($ms[3])) {
                    $title = trim($ms[3]);
                }
                if ($title) {
                    $breadCrumbs[ $level ] = [$title, Router::getFullURI()];
                    ksort($breadCrumbs);
                    $breadCrumbs        = array_slice($breadCrumbs, 0, $level + 1, true);
                    $_SESSION[ $sname ] = $breadCrumbs;
                }
            }

            if ($crumb && $breadCrumbs) {
                $view->assign('breadCrumbs', $breadCrumbs);
            }
        }
        unset($ann);

        return $view;
    }
836017
public function url($action, $params=[]) {
		if(is_array($action))
			return $this->resolver->url($action, $params);
		else
			return $this->resolver->url([get_called_class(), $action], $params);
	}
991495
public function getRules($action = null){

        $rules = $this->rules;

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

        return $this->parserValidationRules($rules, $this->id);
    }
862894
public function Link($action = null)
    {
        if ($this->reportObject) {
            return $this->reportObject->getLink($action);
        }

        // Basic link to this cms section
        return parent::Link($action);
    }
508514
public function add_admin_page( $tab, $action ) {
		if ( 'github_updater_remote_management' === $tab ) {
			$action = add_query_arg( 'tab', $tab, $action ); ?>
			<form class="settings" method="post" action="<?php esc_attr_e( $action ); ?>">
				<?php
				settings_fields( 'github_updater_remote_management' );
				do_settings_sections( 'github_updater_remote_settings' );
				submit_button();
				?>
			</form>
			<?php
			$reset_api_action = add_query_arg( [ 'github_updater_reset_api_key' => true ], $action );
			?>
			<form class="settings no-sub-tabs" method="post" action="<?php esc_attr_e( $reset_api_action ); ?>">
				<?php submit_button( esc_html__( 'Reset RESTful key', 'github-updater' ) ); ?>
			</form>
			<?php
		}
	}
269885
private function plugin_action_links( $links ) {
		$link = $this->get_view( 'admin/include/action_links', [
			'url' => menu_page_url( $this->get_menu_slug(), false ),
		] );
		array_unshift( $links, $link );

		return $links;
	}
514296
protected function actionLink($action, $member = null)
    {
        if (!$member) {
            $member = Member::currentUser();
        }
        if (!$member) {
            return false;
        }

        /**
         * @todo: How do we handle "DataObject" instances that don't have a Link to reject/spam/delete?? This may
         * we have to make CMS a hard dependency instead.
         */
        // if (!$this->Parent()->hasMethod('Link')) {
        //     return false;
        // }

        $url = Controller::join_links(
            Director::baseURL(),
            'comments',
            $action,
            $this->ID
        );

        // Limit access for this user
        $token = $this->getSecurityToken();
        return $token->addToUrl($url, $member);
    }
1140602
private function getResolvedAction(MenuAction $action)
    {
        $actionId = $action->getId();
        if(!isset($this->resolvedActions[$actionId])){
            try{
                if($action->getContext() == '*'){
                    //we assume the star context is not permission aware
                    $this->resolvedActions[$actionId] = null;
                }  else {

                    $resolver = new ActionResolver($action->getUrl());
                    $resolvedAction = [
                        'id'         => $action->getId(),
                        'context'    => $action->getContext(),
                        'controller' => $resolver->getController(),
                        'action'     => $resolver->getAction(),
                    ];
                    $resolvedAction['required'] = array_keys(
                        ControllerHelper::getRequiredRights($resolvedAction['controller'], $resolvedAction['action'])
                    );

                    $this->resolvedActions[$actionId] = $resolvedAction;
                }
            } catch(\ResolverException $re) {
                $this->resolvedActions[$actionId] = null;
                \common_Logger::d('do not handle permissions for action : ' . $action->getName() . ' ' . $action->getUrl());
            } catch(\Exception $e){

                $this->resolvedActions[$actionId] = null;
                \common_Logger::d('do not handle permissions for action : ' . $action->getName() . ' ' . $action->getUrl());
            }
        }

        return $this->resolvedActions[$actionId];
    }
686353
protected function getTarget(AdminInterface $admin, $object)
    {
        return $this->actionManager->findOrCreateComponent($admin->getClass(), $admin->id($object));
    }