Process Module (ProcessWire)

Aus Wikizone
Wechseln zu: Navigation, Suche
ProcessWire - Module schreiben
https://github.com/ryancramerdesign/ProcessHello/blob/master/ProcessHello.info.php - Beispiel Process Modul

Process Module erweitern die Funktionalität im Admin Bereich.

Dafür gibt es einige spezielle Möglichkeiten.

Admin Bereich anpassen

Seiten im Admin Hinzufügen

Geht über die getModuleInfo Funktion oder über die MeinModul.Info.php Konfigurationsdatei (siehe Beispiel Modul)

// page that you want created to execute this module
	'page' => array(
		'name' => 'helloworld',
		'parent' => 'setup', 
		'title' => 'Hello World'
	),

Extra Navigation im Admin Hinzufügen

Wie bei zusätzlicher Seite

	// optional extra navigation that appears in admin
	// if you change this, you'll need to a Modules > Refresh to see changes
	'nav' => array(
		array(
			'url' => '', 
			'label' => 'Hello', 
			'icon' => 'smile-o', 
		), 
		array(
			'url' => 'something/', 
			'label' => 'Something', 
			'icon' => 'beer', 
		),
	)

JSON Nav

Man kann auch die Option

'useNavJSON' => true,

setzen, dann kann man über die Funktion

public function ___executeNavJSON(array $options = array())

aufwändigere Dinge realisieren (Beispiel in Adrians ProcessAdminActions)

Zugriff regeln

Ebenso lassen sich Permissions definieren

	// name of permission required of users to execute this Process (optional)
	'permission' => 'helloworld', 
	// permissions that you want automatically installed/uninstalled with this module (name => description)
	'permissions' => array(
		'helloworld' => 'Run the HelloWorld module'
	),