Generates a navbar form.
@param mixed $action the form action URL.
@param string $method form method (e.g. post, get).
@param array $htmlOptions additional HTML attributes
@return string the generated form.
961671
public static function navbarForm($action, $method = 'post', $htmlOptions = array())
    {
        self::addCssClass('navbar-form', $htmlOptions);
        return self::form($action, $method, $htmlOptions);
    }
1147721
public function methodName2URL($method)
    {
        if (! $this->restful)
            return parent::methodName2URL($method);

        $method = preg_replace('/Action$/i', '', $method);
        $method = preg_replace('/^(' . self::HTTP_METHOD_ANY . ')/i', '', $method);
        return trim(strtolower(preg_replace('/[A-Z]/', '-\0', $method)), '-');
    }
813146
public static function menuHeader($label, $htmlOptions = array())
    {
        self::addCssClass('dropdown-header', $htmlOptions);
        return self::tag('li', $htmlOptions, $label);
    }
184341
public function open($method, $action = '', $attr = array())
    {
        // check if they wish to send a file
        // default to post method and add the enctype needed to send files
        $method = strtolower($method);
        if ($method === 'file') {
            $method = 'post';
            $attr['enctype'] = 'multipart/form-data';
        }

        if (! in_array($method, array('post', 'get'))) {
            $method = 'post';
        }

        $attr['method'] = $method;
        $attr['action'] = $action;

        return $this->Html->tag('form', $attr);
    }
466828
public function callAction($method, $parameters)
    {
        $response = call_user_func_array([$this, $method], $parameters);

        if (is_null($response) && ! is_null($this->layout)) {
            $response = $this->layout;
        }

        return $response;
    }
1115360
public function addRoute($method, $uri, $action)
    {
        $uri = strtolower($uri);
        $action = $this->parseAction($action);

        if (isset($this->groupAttributes)) {
            if (isset($this->groupAttributes['prefix'])) {
                $uri = trim($this->groupAttributes['prefix'], '/').'/'.trim($uri, '/');
            }

            $action = $this->mergeGroupAttributes($action);
        }

        $uri = '/'.trim($uri, '/');

        if (isset($action['as'])) {
            $this->namedRoutes[$action['as']] = $uri;
        }

        $this->routes[$this->identifier] = ['method' => $method, 'uri' => $uri, 'action' => $action];
        $this->identifier++;

        return $this;
    }
309269
private function createDocblockForMethod(
    $requestMethod,
    $action,
    $getParams,
    $postParams
  )
  {
    if (empty($action->doc))
    {
      $action->doc = 'TODO';
    }

    /*
     * $action->doc
     * METHOD: /{url:[a-z]+}
     */
    $docblock = new DocBlockGenerator(
      $action->doc,
      strtoupper($requestMethod) . ': ' . $action->url
    );

    foreach ($getParams as $param)
    {
      //@param $paramName
      $docblock->setTag(new GenericTag('param', "\${$param->getName()}"));
    }

    foreach ($postParams as $postParam)
    {
      //@postParam('paramName')
      $docblock->setTag(new GenericTag('postParam', "('{$postParam->getName()}')"));
    }

    if (!empty($action->throws))
    {
      //@throws \Name\Space\Version\Exceptions\EntityName\SomethingException
      $docblock->setTag(
        new GenericTag(
          'throws',
          sprintf(
            "\\%s\\%s\\Exceptions\\%s\\%s",
            Generator::$namespace,
            $this->version,
            $this->entityName,
            $action->throws->exception
          )
        )
      );
    }

    if (!empty($action->returns))
    {
      //@returns \Name\Space\Version\EntityName\EntityName(s)?Response
      $docblock->setTag(
        new GenericTag(
          'returns',
          sprintf(
            "\\%s\\%s\\Responses\\%s\\%s",
            Generator::$namespace,
            $this->version,
            $this->entityName,
            $action->returns
          )
        )
      );
    }

    return $docblock;
  }
429601
public function setHeader($action, $method = 'POST', array $attributes = array())
    {
        $this->setAction($action);
        $this->setMethod($method);
        $this->setAttributes($attributes);

        return $this;
    }
1194471
protected static function createBody($options, $method)
    {
        return ('GET' !== $method) ? is_array($options) ? http_build_query($options) : ltrim($options, '&') : null;
    }
814992
protected static function bar($width = 0, $htmlOptions = array())
    {
        self::addCssClass('bar', $htmlOptions);
        $color = TbArray::popValue('color', $htmlOptions);
        if (!empty($color)) {
            self::addCssClass('bar-' . $color, $htmlOptions);
        }
        if ($width < 0) {
            $width = 0;
        }
        if ($width > 100) {
            $width = 100;
        }
        if ($width > 0) {
            $width .= '%';
        }
        self::addCssStyle("width: {$width};", $htmlOptions);
        $content = TbArray::popValue('content', $htmlOptions, '');
        return self::tag('div', $htmlOptions, $content);
    }
1148598
public function renderFormAction(
        Action $action,
        Request $request,
        FormInterface $form,
        $data = null,
        array $viewParameters = []
    ): Response {
        $viewParameters = array_merge($this->getViewParameters($action, $request, $form, $data), $viewParameters);

        return $this->renderAction($action, $viewParameters);
    }
684715
public function add_action(moodle_url $url, $label, $method = 'get') {

        $action = new stdClass();
        $action->url = $url;
        $action->label = $label;
        $action->method = $method;

        $this->actions[] = $action;
    }
1050560
protected function applyPublicMethodsHaveActionSuffix(MethodNode $method)
    {
        if (substr($method->getName(), -6, 6) === 'Action') {
            return;
        }

        /** @var \PDepend\Source\AST\ASTMethod $method */
        if ($method->isProtected() || $method->isPrivate()) {
            return;
        }

        if ($this->isNotActionMethod($method->getName())) {
            return;
        }

        $this->addViolation(
            $method,
            [
                sprintf(
                    'The controller method %s is not suffixed with "Action" which violates rule "' . static::RULE . '"',
                    $method->getFullQualifiedName()
                ),
            ]
        );
    }
150419
protected function getFormBuilder(Action $action, $data, array $options = []): FormBuilderInterface
    {
        if (!$action->getFormType()) {
            throw new \UnexpectedValueException("Missing parameter 'form_type' for action '{$action->getCode()}'");
        }

        return $this->get('form.factory')->createNamedBuilder(
            "form_{$this->admin->getCode()}_{$action->getCode()}",
            $action->getFormType(),
            $data,
            $options
        );
    }
1137781
public static function btn($tag, $label, $htmlOptions = array())
    {
        ArrayHelper::addValue('class', 'button', $htmlOptions);

        $icon = ArrayHelper::removeValue($htmlOptions, 'icon');
        if (isset($icon))
            $label = Icon::icon($icon) . '&nbsp;' . $label;

        return \CHtml::tag($tag, $htmlOptions, $label);
    }
215706
protected function parseAction(string $action, string $method): string
    {
        if ('post' === $method) {
            return $this->getSlug().'_'.$action;
        }

        return $action;
    }
231639
public static function startForm($action = '', $method = 'post', array $attrs = [])
    {
        $attrs = array_merge([
            'action' => $action,
            'method' => $method,
        ], $attrs);

        return static::startTag('form', $attrs);
    }