definition list of Processes attached to each child page.
*
* For more details about how Process modules work, please see:
* /wire/core/Process.php
*
* ProcessWire 2.x
* Copyright (C) 2012 by Ryan Cramer
* Licensed under GNU/GPL v2, see LICENSE.TXT
*
* http://www.processwire.com
* http://www.ryancramer.com
*
*/
class ProcessList extends Process {
public static function getModuleInfo() {
return array(
'title' => __('List', __FILE__), // getModuleInfo title
'summary' => __('Lists the Process assigned to each child page of the current', __FILE__), // getModuleInfo summary
'version' => 101,
'permanent' => true,
'permission' => 'page-view',
);
}
public function ___execute() {
return $this->render();
}
protected function render() {
$out = "\n
";
$cnt = 0;
foreach($this->page->children("check_access=0") as $child) {
if(!$child->viewable()) continue;
if($child->process) {
$info = $this->modules->getModuleInfoVerbose($child->process, array('noCache' => true));
$icon = $info['icon'] ? " " : '';
$title = $child->title;
if(!strlen($title)) $title = $info['title'];
if(!strlen($title)) $title = $child->name;
$titleTranslated = __($title, '/wire/templates-admin/default.php');
if($titleTranslated && $titleTranslated != $title) $title = $titleTranslated;
$title = $this->wire('sanitizer')->entities1($title);
if($child->summary) $summary = $child->summary;
else $summary = $info['summary'];
$summary = $this->wire('sanitizer')->entities1($summary);
$class = '';
} else {
$title = $child->get("title|name");
if($child->template == 'admin') {
$summary = $this->_('The process module assigned to this page does not appear to be installed.');
$class = " class='ui-priority-secondary'";
} else if($child->summary) {
$summary = $this->wire('sanitizer')->entities($child->getUnformatted('summary'));
} else {
$summary = '';
}
$icon = '';
}
$out .= "\n\t- $icon$title
";
if($summary) $out .= "\n\t- $summary
";
$cnt++;
}
$out .= "\n
";
if(!$cnt) $out = '';
return $out;
}
}