承接 inspiredminds/contao-backend-forms 相关项目开发

从需求分析到上线部署,全程专人跟进,保证项目质量与交付效率

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

inspiredminds/contao-backend-forms

最新稳定版本:1.1.1

Composer 安装命令:

composer require inspiredminds/contao-backend-forms

包简介

Extension to Contao Haste for quick creation of back end forms.

README 文档

README

Contao Backend Forms

Extension of Codefog\HasteBundle\Form\Form of codefog/contao-haste to quickly build a form for the back end.

Example

Create the form like a regular Haste Form, just via the BackendForm class in your back end controller for example:

// src/Controller/MyFormController.php
namespace App\Controller;

use Contao\CoreBundle\Controller\AbstractBackendController;
use InspiredMinds\ContaoBackendFormsBundle\Form\BackendForm;
use Symfony\Component\HttpFoundation\RedirectResponse;
use Symfony\Component\HttpFoundation\Request;
use Symfony\Component\HttpFoundation\Response;
use Symfony\Component\Routing\Annotation\Route;

#[Route('%contao.backend.route_prefix%/my-form', name: self::class, defaults: ['_scope' => 'backend'])]
class MyFormController extends AbstractBackendController
{
    public function __invoke(Request $request): Response
    {
        $form = new BackendForm('my-form', 'POST');

        $form->addFormField('lorem', [
            'label' => ['Lorem', 'Lorem description.'],
            'inputType' => 'text',
            'eval' => ['tl_class' => 'w50', 'maxlength' => 255],
        ]);

        $form->addFormField('ipsum', [
            'label' => ['Ipsum', 'Ipsum description.'],
            'inputType' => 'text',
            'eval' => ['tl_class' => 'w50', 'maxlength' => 255],
        ]);

        $form->addSubmitFormField('Submit');

        if ($form->validate()) {
            // Do something …

            return new RedirectResponse($request->getUriForPath($request->getPathInfo()));
        }

        return $this->render('my-form.html.twig', [
            'title' => 'My form',
            'headline' => 'My form',
            'form' => $form,
        ]);
    }
}
{# templates/my-form.html.twig #}
{% extends "@Contao/be_main" %}

{% block main_content %}
    {{ form.generate()|raw }}
{% endblock %}

This would then render a form like this:

统计信息

  • 总下载量: 6.66k
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 2
  • 点击次数: 2
  • 依赖项目数: 3
  • 推荐数: 0

GitHub 信息

  • Stars: 2
  • Watchers: 3
  • Forks: 2
  • 开发语言: PHP

其他信息

  • 授权协议: LGPL-3.0-or-later
  • 更新时间: 2019-04-11

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固