bigfoot / content-bundle
Bigfoot 内容包
v2.2.1
2014-11-24 11:00 UTC
Requires
- bigfoot/core-bundle: ~2.2
- dev-master / 4.0.x-dev
- 3.x-dev
- 3.0.x-dev
- 2.2.x-dev
- v2.2.1
- 2.2
- 2.1.x-dev
- v2.1.2
- v2.1.1
- v2.1.0
- v2.0.0
- v1.0.0
- dev-bugfix/wrong-ref
- dev-bugfix/remove-useless-option
- dev-improve-content-bundle
- dev-undeprecatization
- dev-updaterepo
- dev-feat-route-manager
- dev-stabilisation
- dev-feat-58
- dev-context
- dev-demo
- dev-content
- dev-refacto
- dev-feat-dev-content-dashboard
- dev-fixbug
- dev-test
- dev-bug
- dev-fix
- dev-shuot
This package is auto-updated.
Last update: 2024-08-27 23:54:32 UTC
README
ContentBundle 是 C2IS 创建的 BigFoot 框架的一部分。
安装
将 'BigFoot/ContentBundle' 添加到您的 composer.json 文件中的 'require' 部分
"require": { ... ... "bigfoot/content-bundle": "dev-master", }
更新您的项目
php composer.phar update
配置
为了将小部件添加到仪表板部分,您必须在您的 config.yml
文件中添加参数。
# app/config/config.yml bigfoot_content: widgets: widget_test: 'Bigfoot\Bundle\ContentBundle\Widget\WidgetTest' widget_most_viewed_hotel: 'Bigfoot\Bundle\ContentBundle\Widget\WidgetMostViewedHotel'
用法
添加页面
转到 页面
部分,管理页面。
添加静态内容
转到 静态内容
并管理静态内容。注意,所有静态内容都将列在 仪表板
部分中。
添加小部件
在您的 config.yml
文件中添加您的widget的名称和类。(见配置部分)。
在Widget目录中创建您的类,它必须扩展位于Model目录中的抽象类 AbstractWidget
。
/* Widget/WidgetTest.php */ namespace Bigfoot\Bundle\ContentBundle\Widget; use Bigfoot\Bundle\ContentBundle\Model\AbstractWidget; class WidgetTest extends AbstractWidget { /** * The name of your Widget * @return Slug */ public function getName() { return 'widget_test'; } /** * Label of your Widget * Displayed in the Dashboard section */ public function getLabel() { return 'The Widget Test'; } /** * Parameters of your Widget * These parameters have to be the parameters of the target Action Controller. */ public function getDefaultParameters() { return array( 'page_id' => 1 ); } /** * The target Route of your Widget * Route of the action controller */ public function getRoute() { return 'content_page'; } /** * Form type of your Widget * This is the specific form of your Widget to add your custom parameters * The parent have to be `bigfoot_bundle_contentbundle_widgettype` */ public function getParametersType() { return 'Bigfoot\Bundle\ContentBundle\Form\WidgetTestType'; } }
创建您的Widget的表单类型
/* Form/WidgetTestType.php */ namespace Bigfoot\Bundle\ContentBundle\Form; use Symfony\Component\Form\AbstractType; use Symfony\Component\Form\FormBuilderInterface; use Symfony\Component\OptionsResolver\OptionsResolver; class WidgetTestType extends AbstractType { protected $container; /** * Constructor * * @param $container */ public function __construct($container) { $this->container = $container; } /** * @param FormBuilderInterface $builder * @param array $options */ public function buildForm(FormBuilderInterface $builder, array $options) { $builder ->add('page_id'); } /** * @param OptionsResolverInterface $resolver */ public function configureOptions(OptionsResolver $resolver) { $resolver->setDefaults(array( 'data_class' => 'Bigfoot\Bundle\ContentBundle\Entity\Widget' )); } /** * @return string */ public function getName() { return 'bigfoot_bundle_contentbundle_widgettesttype'; } /** * This method has to return 'bigfoot_bundle_contentbundle_widgettype' * @return string */ public function getParent() { return 'bigfoot_bundle_contentbundle_widgettype'; } }
管理您的侧边栏
转到 仪表板
部分。
创建侧边栏
点击右侧的 新建侧边栏
图标。
将小部件/静态内容分配给侧边栏
左侧列出了所有您的Widget和静态内容。将它们拖放到任何侧边栏中。
管理顺序
您可以通过拖放任何受影响的小部件/静态内容来排序。通过点击侧边栏标题左侧的图标进行验证。