1
0
mirror of https://github.com/processwire/processwire.git synced 2025-08-11 17:24:46 +02:00

A couple of other minor updates to Session and FieldtypeModule

This commit is contained in:
Ryan Cramer
2018-08-03 12:21:00 -04:00
parent 95adb8039c
commit f61bca5d9f
2 changed files with 10 additions and 4 deletions

View File

@@ -906,8 +906,9 @@ class Session extends Wire implements \IteratorAggregate {
if(!$user || !$user instanceof User) {
$name = $this->wire('sanitizer')->pageNameUTF8($name);
$user = $this->wire('users')->get("name=" . $this->wire('sanitizer')->selectorValue($name));
if(!$user || !$user->id) return false;
}
if(!$user || !$user->id || !$user instanceof User) return false;
if($user->isGuest()) return false;
$xroles = $this->wire('config')->loginDisabledRoles;
if(!is_array($xroles) && !empty($xroles)) $xroles = array($xroles);
if($name) {}

View File

@@ -89,6 +89,10 @@ class FieldtypeModule extends Fieldtype {
if($field->labelField == 'title') {
$info = $this->wire('modules')->getModuleInfo($module);
$label = !empty($info['title']) ? $info['title'] : (string) $module;
} else if($field->labelField == 'title-summary') {
$info = $this->wire('modules')->getModuleInfoVerbose($module);
$label = !empty($info['title']) ? $info['title'] : (string) $module;
if(!empty($info['summary'])) $label .= " [span.detail] • " . $info['summary'] . ' [/span]';
} else {
$label = (string) $module;
}
@@ -151,8 +155,9 @@ class FieldtypeModule extends Fieldtype {
$f = $this->modules->get('InputfieldRadios');
$f->label = $this->_('Options Label');
$f->attr('name', 'labelField');
$f->addOption('', $this->_('Module Class Name'));
$f->addOption('title', $this->_('Module Title'));
$f->addOption('', $this->_('Name'));
$f->addOption('title', $this->_('Title'));
$f->addOption('title-summary', $this->_('Title and summary'));
$f->attr('value', $field->labelField);
$f->columnWidth = 50;
$inputfields->add($f);