From 14360bceef755f4cb943b13fd83f5a10ca541079 Mon Sep 17 00:00:00 2001 From: Cameron <e107inc@gmail.com> Date: Mon, 11 Apr 2016 00:27:48 -0700 Subject: [PATCH] Added e_admin.php example to _blank plugin. --- e107_plugins/_blank/e_admin.php | 79 +++++++++++++++++++++++++++++++++ 1 file changed, 79 insertions(+) create mode 100644 e107_plugins/_blank/e_admin.php diff --git a/e107_plugins/_blank/e_admin.php b/e107_plugins/_blank/e_admin.php new file mode 100644 index 000000000..3b71da17b --- /dev/null +++ b/e107_plugins/_blank/e_admin.php @@ -0,0 +1,79 @@ +<?php + + +//v2.x Standard for extending admin areas. + + +class _blank_admin +{ + /** + * Extend Admin-ui Parameters + * @param $ui admin-ui object + * @return array + */ + public function config($ui) + { + $action = $ui->getAction(); // current mode: create, edit, list + $type = $ui->getEventName(); // 'wmessage', 'news' etc. (core or plugin) + $id = $ui->getId(); + + $config = array(); + $defaultValue = 'http://'; + + switch($type) + { + case "news": // hook into the news admin form. + $config['fields']['url'] = array ( 'title' =>"CUstom Field", 'type' => 'url', 'tab'=>1, 'writeParms'=> array('size'=>'xxlarge', 'placeholder'=>'', 'default'=>$defaultValue), 'width' => 'auto', 'help' => '', 'readParms' => '', 'class' => 'left', 'thclass' => 'left', ); + break; + } + + //Note: 'urls' will be returned as $_POST['x__blank_url']. ie. x_{PLUGIN_FOLDER}_{YOURFIELDKEY} + + return $config; + + } + + + /** + * Process Posted Data. + * @param object $ui admin-ui + * @param int $id - Primary ID of the record being created/edited/deleted + */ + public function process($ui, $id=0) + { + + $data = $ui->getPosted(); + $type = $ui->getEventName(); + $action = $ui->getAction(); // current mode: create, edit, list + + if($action == 'delete') + { + return; + } + + + if(!empty($id) ) + { + + if(!empty($data['x__blank_url'])) + { + + // Save the data in 'blank' plugin table. . + + } + + + } + + + + } + + + +} + + + + +?> \ No newline at end of file