piedweb / conversation
dev-master / 0.x-dev
2020-12-09 16:50 UTC
Requires
Requires (Dev)
- phpunit/phpunit: ^9
- squizlabs/php_codesniffer: ^3.5
- symfony/phpunit-bridge: ^5.0
This package is auto-updated.
Last update: 2022-02-24 23:59:32 UTC
README
对话
通过添加评论、联系表单或简单的用户输入扩展页面...
在静态网站上添加对话。
最初开发用于与PiedWeb/CMS一起使用。
安装
# Get the Bundle
composer require piedweb/conversation
# Add the route to your Routes:
conversation:
resource: '@PiedWebConversationBundle/Resources/config/routes/conversation.yaml'
更新sonata_admin配置文件以添加导航链接
groups:
app.admin.group.page:
label: admin.label.content
label_catalogue: messages
items:
- piedweb.admin.page
- piedweb.admin.media
- piedweb.admin.conversation
(或 ln -s -f vendor/piedweb/cms-bundle/src/Resources/config/packages/sonata_admin.fullFeatured.yaml config/packages/sonata_admin.yaml
)
用法
您可以直接使用它并将它以两种方式包含在您的页面中
# Load form via fetch (javascript) <div data-live="{{ path('piedweb_cms_conversation', {'type': 'newsletter', 'referring': 'nslttr-'~page.slug}) }}"></div> # Render form in Controller {{ render(controller('PiedWeb\\ConversationBundle\\Controller\\ConversationFormController::show')) }} # Or add a button to click before loading block <button src-data-live="{{ path('piedweb_cms_conversation', {'type': 'newsletter', 'referring': 'nslttr-'~page.slug}) }}" class="btn btn-primary">Register</button>
使用data-live
元素
import { liveForm } from "piedweb-cms-js-helpers/src/helpers";
// on dom changed and on page loaded :
liveBlock();
```
### Render published comment
```twig
{{ showConversation(referring[, orderBy, limit, template]) }}
获取新消息的邮件通知
配置包(piedweb_conversation.notification_emailTo
)并编程cron
bin/console conversation:notify
自定义
小渲染自定义
通过覆盖@PiedWebConversation/_conversation.html.twig
(或'@PiedWebConversation/_'.$type.'Step'.$step.'.html.twig
或'@PiedWebConversation/_'.$type.$referring.'Step'.$step.'.html.twig
)。
创建新表单
默认情况下,有3种表单类型:newsletter
、message
和multiStepMessage
。
在配置中添加新类 piedweb_conversation.form.myNewType: myNewFormClass
。
待办事项
- 测试
- 从默认视图文件中删除bootstrap类(通过将它们移动到PiedWebThemeComponent)
- 新消息的电子邮件验证器
贡献者
许可
MIT(有关详细信息,请参阅LICENSE文件)