Extend Settings Panel via theme/plugin

Post Reply
pawciak
Jr. Bludit
Posts: 5
Joined: Thu Jun 04, 2020 2:50 pm

Hi,

I'm exploring further possibilities to craft Bludit to my certain needs. As most of my work for hire work I've based on environments like wordpress/drupal and processwire, where it's quite easy to add new dashboard/admin functionalities via theme (or plugin when needed). What about bludit? AFAIK the only thing is changing the kernel files, right?

I saw the hook list:
https://docs.bludit.com/en/plugins/hooks-list

but unfortunately, there is not a single example of how to utilize them. What I'm trying to add is a page under SETTINGS, or at least a tab over general settings where a user will have a bunch of predefined by me custom fields.

Sure I can overwrite the core files but it will be quite painful when new version of bludit will pop up. tanks for clarification
User avatar
Edi
Site Admin
Posts: 3121
Joined: Sun Aug 09, 2015 5:01 pm
Location: Zurich
Has thanked: 54 times
Been thanked: 77 times
Contact:

You can code your own admin theme.

Concerning the hooks you can for example also use JavaScript/jQuery.
Clickwork - Websites mit Bludit | Planet Bludit - Tipps und Snippets
pawciak
Jr. Bludit
Posts: 5
Joined: Thu Jun 04, 2020 2:50 pm

thanks,

one question - I've created a tiny plugin to enhance my custom admin theme. The code looks like that:

Code: Select all

<?php

class pluginGameEssentials extends Plugin {

	public function init()
	{
		$this->dbFields = array(
			'discord'=>			'',
			'mainurl'=>			'',
			'origin'=>			'',
			'ns'=>				'',
			'gogcom'=>			'',
			'humblebundle'=>	'',
			'xone'=>			'',
			'psn'=>				'',
			'epic'=>			'',
			'steam'=>			'', 
		);
	}

	public function discord()
	{
		return $this->getField('discord');
	}

	public function steam()
	{
		return $this->getField('steam');
	}

	public function epic()
	{
		return $this->getField('epic');
	}

	public function psn()
	{
		return $this->getField('psn');
	}

	public function xone()
	{
		return $this->getField('xone');
	}

	public function humblebundle()
	{
		return $this->getField('humblebundle');
	}

	public function gogcom()
	{
		return $this->getField('gogcom');
	}

	public function ns()
	{
		return $this->getField('ns');
	}

	public function origin()
	{
		return $this->getField('origin');
	}

	public function mainurl()
	{
		return $this->getField('mainurl');
	}
}
I wanted to show those fields in a settings tab. But when I'm calling them via

Code: Select all

echo Bootstrap::formInputText(array(
			'name'=>'mainurl',
			'label'=>'Main game',
			'value'=>$site->mainurl(),
			'class'=>'',
			'placeholder'=>'',
			'tip'=>''
		));
it shows nothing. When I place that code on settings.php file it works. I'm not sure where the issue occurs, might be a situation when the cms is calling a function which in the core/kernel doesn't exists and somehow discard the fact its available via plugin (which is activated). Any tips on that? just wanted to be sure how far i can go with plugins before editing other files
User avatar
Edi
Site Admin
Posts: 3121
Joined: Sun Aug 09, 2015 5:01 pm
Location: Zurich
Has thanked: 54 times
Been thanked: 77 times
Contact:

There are a hook and a script missing to add the tab/fields.
Clickwork - Websites mit Bludit | Planet Bludit - Tipps und Snippets
pawciak
Jr. Bludit
Posts: 5
Joined: Thu Jun 04, 2020 2:50 pm

Thanks Edi, but can you elaborate a bit more? because afaik the docs do not cover that much. Obviously I do not expect to write the code by you or Diego, but would be great to hear few tips how to achieve what im working on.

At the moment for the test purposes I was placing everything in the settings.php file, and sure - it works. But as mentioned previously wanted to avoid situation when I'm achieving something via overwriting the core files
Post Reply