Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Theme settings and Blocks #894

Open
dignajar opened this Issue Dec 27, 2018 · 0 comments

Comments

1 participant
@dignajar
Copy link
Member

commented Dec 27, 2018

I'm looking for implement some kind of settings for themes, so the developers of themes can include inputs from the users.

1. Blocks

One of the idea mention by @dimobelov and testing in Github code are called Blocks.

  1. The Blocks are separated from the themes system
  2. The theme can include a file called blocks.php in the root. Example, https://github.com/bludit/bludit/blob/master/bl-themes/alternative/blocks.php
  3. The file blocks.php can include calls to add/edit/remove blocks.
  4. The file blocks.php is called when the user activate the theme
  5. The Blocks are deleted before the theme is activated, because each theme can have differents blocks.

1.1 Structure of Blocks

key
title
value
description

1.2 Add / Edit / Remove a Block

<?php
	# Add / Edit Block
	$blocks->add(array(
		'key'=>'test',
		'title'=>'Testing Blocks',
		'value'=>'Some HTML code or string value',
		'description'=>'Description for the user'
	));

	# Delete Block
	$blocks->delete('test');
?>

1.3 How to call a Block

<?php
	# Get the title of the Block by the key 'test'
	$title = $blocks->get('test')->title();

	# Get the value of the Block by the key 'test'
	$value = $blocks->get('test')->value();
?>

@dignajar dignajar changed the title [BRAINSTORMING] Theme settings and Blocks Theme settings and Blocks Dec 27, 2018

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.