承接 tparushev/carbon-section-builder 相关项目开发

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

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

tparushev/carbon-section-builder

Composer 安装命令:

composer require tparushev/carbon-section-builder

包简介

Helpers for building section builder with Carbon Fields.

README 文档

README

Helpers for building section builder with Carbon Fields.

Quick setup

Extend the Base_Section class with namespace to make your own sections. You can find examples in the examples/ folder.

The extender section class must include fields method that is returning an array with Carbon_Field, and set_name method to set the section name. Example:

class Home_Intro extends Base_Section {
	public function set_name() {
		$this->name = __( 'Home Intro2', 'crb' );
	}
	
	public function fields() {
		return array(
			Field::make( 'file', 'first_image', __( 'Image', 'crb' ) )
				->set_width( 50 ),
			Field::make( 'file', 'second_image', __( 'Image', 'crb' ) )
				->set_width( 50 ),
			Field::make( 'rich_text', 'content', __( 'Content', 'crb' ) ),
		);
	}
}

The section builder is used in the Carbon Fields Container as following:

use Carbon_Fields\Container\Container;
use Carbon_Section_Builder\Builder;
use Sections\Home_Intro\Home_Intro;
use Sections\Home_News\Home_News;

Container::make( 'post_meta', __( 'Page Sections' ,'text-domain' ) )
	->where( 'post_type', '=', 'page' )
	->add_fields( 
		array( Builder::make( 'crb_sections', __( 'Home Sections', 'text-domain' ) )
			->add_section( Home_Intro::make() )
			->add_section( Home_News::make() )
			->load() 
		)
	);

To render the sections in some template, use the Section_Renderer class or extend the Renderer interface. Example:

use Carbon_Section_Builder\Renderer\Sections_Renderer;

get_header();

Sections_Renderer::init( 'crb_sections' )->render();

get_footer();

统计信息

  • 总下载量: 402
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 0
  • 点击次数: 1
  • 依赖项目数: 0
  • 推荐数: 0

GitHub 信息

  • Stars: 0
  • Watchers: 1
  • Forks: 0
  • 开发语言: PHP

其他信息

  • 授权协议: GPL-2.0-only
  • 更新时间: 2019-12-05

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固