Permalink
Browse files

Various minor tweaks and documentation improvements

  • Loading branch information...
ryancramerdesign committed Nov 14, 2016
1 parent 2d9e959 commit 654c18fbe90a69844be50d28ee645336c1c4da53
View
@@ -26,6 +26,8 @@
/*** SITE CONFIG *************************************************************************/
/** @var Config $config */
/**
* Enable debug mode?
*
View
@@ -26,6 +26,8 @@
/*** SITE CONFIG *************************************************************************/
/** @var Config $config */
/**
* Enable debug mode?
*
View
@@ -26,6 +26,8 @@
/*** SITE CONFIG *************************************************************************/
/** @var Config $config */
/**
* Enable debug mode?
*
View
@@ -26,6 +26,8 @@
/*** SITE CONFIG *************************************************************************/
/** @var Config $config */
/**
* Enable debug mode?
*
@@ -26,6 +26,8 @@
/*** SITE CONFIG *************************************************************************/
/** @var Config $config */
/**
* Enable debug mode?
*
View
@@ -17,6 +17,7 @@
*
* @method void install()
* @method void uninstall()
* @method array getExtraMarkup()
*
*/
View
@@ -20,6 +20,7 @@
* @property string $httpHost Current HTTP host name. #pw-group-HTTP-and-input
* @property bool $https If the current request is an HTTPS request, this is set to true. #pw-group-runtime
* @property string $version Current ProcessWire version string (i.e. "2.2.3") #pw-group-system #pw-group-runtime
* @property int $systemVersion System version, used by SystemUpdater to determine when updates must be applied. #pw-group-system #pw-group-runtime
*
* @property FilenameArray $styles Array used by ProcessWire admin to keep track of what stylesheet files its template should load. It will be blank otherwise. Feel free to use it for the same purpose in your own sites. #pw-group-runtime
* @property FilenameArray $scripts Array used by ProcessWire admin to keep track of what javascript files its template should load. It will be blank otherwise. Feel free to use it for the same purpose in your own sites. #pw-group-runtime
View
@@ -378,6 +378,19 @@ function paths($key = '') {
return wirePaths($key);
}
/**
* Start or stop a profiler event or return WireProfilerInterface instance
*
* @param string|array|object|null $name Name of event to start or event to stop
* @param null|object|string $source If starting an event, optional source of event (object)
* @param array $data Optional extra data as associative array
* @return null|array|object
*
*/
function profiler($name = null, $source = null, $data = array()) {
return wireProfiler($name, $source, $data);
}
/**
* Get or set a region for front-end output
*
@@ -460,6 +460,26 @@ function wireLog($logName = '', $message = '') {
return $log;
}
/**
* Start or stop a profiler event or return WireProfilerInterface instance
*
* @param string|array|object|null $name Name of event to start or event to stop
* @param null|object|string $source If starting an event, optional source of event (object)
* @param array $data Optional extra data as associative array
* @return null|array|object
*
*/
function wireProfiler($name = null, $source = null, $data = array()) {
$profiler = wire('profiler');
if(is_null($name)) return $profiler;
if(!$profiler) return null;
if(is_string($name)) {
return $profiler->start($name, $source, $data);
} else {
return $profiler->stop($name);
}
}
/**
* Function that returns a $config->urls->[name] value o
*
View
@@ -23,7 +23,7 @@
*
* @property-read Wire|WireData|WireArray|Module $object Instance of the object where the Hook event originated.
* @property-read string $method The name of the method that was called to generate the Hook event.
* @property-read array $arguments A numerically indexed array of the arguments sent to the above mentioned method.
* @property array $arguments A numerically indexed array of the arguments sent to the above mentioned method.
* @property mixed $return Applicable only for 'after' or ('replace' + 'before' hooks), contains the value returned by the above mentioned method. The hook handling method may modify this return value.
* @property bool $replace Set to boolean true in a 'before' hook if you want to prevent execution of the original hooked function. In such a case, your hook is replacing the function entirely. Not recommended, so be careful with this.
* @property array $options An optional array of user-specified data that gets sent to the hooked function. The hook handling method may access it from $event->data. Also includes all the default hook properties.
@@ -110,6 +110,7 @@ public function renderAdminShortcuts() {
if($page->name != 'page' || $this->wire('input')->urlSegment1) return '';
$user = $this->wire('user');
if($this->wire('user')->isGuest() || !$user->hasPermission('page-edit')) return '';
/** @var ProcessPageAdd $module */
$module = $this->wire('modules')->getModule('ProcessPageAdd', array('noInit' => true));
$data = $module->executeNavJSON(array('getArray' => true));
$items = array();
@@ -143,7 +144,7 @@ public function renderAdminNotices($notices, array $options = array()) {
if($this->wire('user')->isLoggedin() && $this->wire('modules')->isInstalled('SystemNotifications')) {
$systemNotifications = $this->wire('modules')->get('SystemNotifications');
if(!$systemNotifications->placement) return;
if(!$systemNotifications->placement) return '';
}
$defaults = array(
@@ -232,7 +233,9 @@ public function getPageIcon(Page $p) {
$info = $this->wire('modules')->getModuleInfo($p->process);
if(!empty($info['icon'])) $icon = $info['icon'];
}
if($p->page_icon) $icon = $p->page_icon; // allow for option of an admin field overriding the module icon
// allow for option of an admin field overriding the module icon
$pageIcon = $p->get('page_icon');
if($pageIcon) $icon = $pageIcon;
if(!$icon) switch($p->id) {
case 22: $icon = 'gears'; break; // Setup
case 21: $icon = 'plug'; break; // Modules
@@ -360,6 +363,7 @@ protected function getPageTitle(Page $c) {
// ProcessPageAdd: avoid showing this menu item if there are no predefined family settings to use
$numAddable = $this->wire('session')->getFor('ProcessPageAdd', 'numAddable');
if($numAddable === null) {
/** @var ProcessPageAdd $processPageAdd */
$processPageAdd = $this->wire('modules')->getModule('ProcessPageAdd', array('noInit' => true));
if($processPageAdd) {
$addData = $processPageAdd->executeNavJSON(array("getArray" => true));
@@ -529,9 +533,11 @@ public function renderBodyClass() {
*
*/
public function renderJSConfig() {
/** @var Config $config */
$config = $this->wire('config');
/** @var array $jsConfig */
$jsConfig = $config->js();
$jsConfig['debug'] = $config->debug;
@@ -10,12 +10,26 @@
*
*/
/** @var Config $config */
/** @var AdminThemeDefault $adminTheme */
/** @var User $user */
/** @var Modules $modules */
/** @var Notices $notices */
/** @var Page $page */
if(!defined("PROCESSWIRE")) die();
if(!isset($content)) $content = '';
$searchForm = $user->hasPermission('page-edit') ? $modules->get('ProcessPageSearch')->renderSearchForm() : '';
$version = $adminTheme->version . 'h';
if($user->hasPermission('page-edit')) {
/** @var ProcessPageSearch $searchForm */
$searchForm = $modules->get('ProcessPageSearch');
$searchForm = $searchForm->renderSearchForm();
} else {
$searchForm = '';
}
$version = $adminTheme->version . 'i';
$config->styles->prepend($config->urls->root . "wire/templates-admin/styles/AdminTheme.css?v=$version");
$config->styles->prepend($config->urls->adminTemplates . "styles/" . ($adminTheme->colors ? "main-$adminTheme->colors" : "main-classic") . ".css?v=$version");
@@ -27,6 +41,7 @@
$config->scripts->append($config->urls->adminTemplates . "scripts/main.$ext?v=$version");
require_once(dirname(__FILE__) . "/AdminThemeDefaultHelpers.php");
/** @var AdminThemeDefaultHelpers $helpers */
$helpers = $this->wire(new AdminThemeDefaultHelpers());
$extras = $adminTheme->getExtraMarkup();
@@ -94,7 +109,9 @@
<div class="pw-container container">
<?php
if($page->body) echo $page->body;
$body = $page->get('body');
if($body) echo $body;
unset($body);
echo $content;
echo $extras['content'];
?>
@@ -120,7 +137,9 @@
<?php
echo $extras['footer'];
if($config->debug && $user->isSuperuser()) include($config->paths->root . '/wire/templates-admin/debug.inc');
if($config->debug && $user->isSuperuser()) {
include($config->paths->root . '/wire/templates-admin/debug.inc');
}
?>
</div>
</div><!--/#footer-->
@@ -7,23 +7,28 @@
*
*/
/** @var Config $config */
/** @var ProcessWire $wire */
$config->inputfieldColumnWidthSpacing = 0; // percent spacing between columns
$markup = InputfieldWrapper::getMarkup();
$markup['item_label'] = "\n\t\t<label class='InputfieldHeader' for='{for}'>{out}</label>";
$markup['item_label_hidden'] = "\n\t\t<label class='InputfieldHeader InputfieldHeaderHidden'><span>{out}</span></label>";
$markup['item_content'] = "\n\t\t<div class='InputfieldContent'>\n{out}\n\t\t</div>";
$markup['item_label'] = "<label class='InputfieldHeader' for='{for}'>{out}</label>";
$markup['item_label_hidden'] = "<label class='InputfieldHeader InputfieldHeaderHidden'><span>{out}</span></label>";
$markup['item_content'] = "<div class='InputfieldContent'>{out}</div>";
InputfieldWrapper::setMarkup($markup);
$classes = InputfieldWrapper::getClasses();
$classes['item'] = "Inputfield {class} Inputfield_{name}";
$classes['item_error'] = "InputfieldStateError";
InputfieldWrapper::setClasses($classes);
wire()->addHookBefore('MarkupPagerNav::render', null, 'hookMarkupPagerNavRender');
$wire->addHookBefore('MarkupPagerNav::render', null, 'hookMarkupPagerNavRender');
/**
* Change the default prev/next links for MarkupPagerNav
*
* @param HookEvent $event
*
*/
function hookMarkupPagerNavRender(HookEvent $event) {
@@ -12,10 +12,15 @@
*
*/
/** @var Config $config */
/** @var AdminThemeReno $adminTheme */
/** @var User $user */
/** @var Modules $modules */
if(!defined("PROCESSWIRE")) die();
if(!isset($content)) $content = '';
$version = $adminTheme->version . 'j';
$version = $adminTheme->version . 'k';
$ext = $config->debug ? "js" : "min.js";
// Search form
Oops, something went wrong.

0 comments on commit 654c18f

Please sign in to comment.