Skip to content

Commit

Permalink
Various minor updates
Browse files Browse the repository at this point in the history
  • Loading branch information
ryancramerdesign committed Jan 20, 2017
1 parent 0d82cee commit 65eb8da
Show file tree
Hide file tree
Showing 5 changed files with 43 additions and 21 deletions.
20 changes: 20 additions & 0 deletions wire/core/Page.php
Original file line number Diff line number Diff line change
Expand Up @@ -94,6 +94,16 @@
* @method bool addable($pageToAdd = null) Returns true if the current user can add children to the page, false if not. Optionally specify the page to be added for additional access checking. #pw-group-access
* @method bool moveable($newParent = null) Returns true if the current user can move this page. Optionally specify the new parent to check if the page is moveable to that parent. #pw-group-access
* @method bool sortable() Returns true if the current user can change the sort order of the current page (within the same parent). #pw-group-access
* @property bool $viewable #pw-group-access
* @property bool $editable #pw-group-access
* @property bool $publishable #pw-group-access
* @property bool $deleteable #pw-group-access
* @property bool $deletable #pw-group-access
* @property bool $trashable #pw-group-access
* @property bool $addable #pw-group-access
* @property bool $moveable #pw-group-access
* @property bool $sortable #pw-group-access
* @property bool $listable #pw-group-access
*
* Methods added by LanguageSupport.module (not installed by default)
* -----------------------------------------------------------------
Expand Down Expand Up @@ -521,12 +531,16 @@ class Page extends WireData implements \Countable, WireMatchable {
*/
static $baseProperties = array(
'accessTemplate' => 'getAccessTemplate',
'addable' => 'm',
'child' => 'm',
'children' => 'm',
'created' => 's',
'createdStr' => '',
'createdUser' => '',
'created_users_id' => 's',
'deletable' => 'm',
'deleteable' => 'm',
'editable' => 'm',
'editUrl' => 'm',
'fieldgroup' => '',
'filesManager' => 'm',
Expand All @@ -543,10 +557,12 @@ class Page extends WireData implements \Countable, WireMatchable {
'isPublic' => 'm',
'isTrash' => 'm',
'isUnpublished' => 'm',
'listable' => 'm',
'modified' => 's',
'modifiedStr' => '',
'modifiedUser' => '',
'modified_users_id' => 's',
'moveable' => 'm',
'name' => 's',
'namePrevious' => 'p',
'next' => 'm',
Expand All @@ -559,20 +575,24 @@ class Page extends WireData implements \Countable, WireMatchable {
'parents' => 'm',
'path' => 'm',
'prev' => 'm',
'publishable' => 'm',
'published' => 's',
'publishedStr' => '',
'render' => '',
'rootParent' => 'm',
'siblings' => 'm',
'sort' => 's',
'sortable' => 'm',
'sortfield' => 's',
'status' => 's',
'statusPrevious' => 'p',
'statusStr' => '',
'template' => 'p',
'templates_id' => '',
'templatePrevious' => 'p',
'trashable' => 'm',
'url' => 'm',
'viewable' => 'm'
);

/**
Expand Down
1 change: 1 addition & 0 deletions wire/core/ProcessWire.php
Original file line number Diff line number Diff line change
Expand Up @@ -354,6 +354,7 @@ public function load(Config $config) {
Debug::timer('boot.load');
}

$this->wire('urls', $config->urls); // shortcut API var
$this->wire('log', new WireLog(), true);
$this->wire('notices', new Notices(), true);
$this->wire('sanitizer', new Sanitizer());
Expand Down
14 changes: 8 additions & 6 deletions wire/core/WireInput.php
Original file line number Diff line number Diff line change
Expand Up @@ -39,25 +39,25 @@
class WireInput extends Wire {

/**
* @var WireInputVars|null
* @var WireInputData|null
*
*/
protected $getVars = null;

/**
* @var WireInputVars|null
* @var WireInputData|null
*
*/
protected $postVars = null;

/**
* @var WireInputVars|null
* @var WireInputData|null
*
*/
protected $cookieVars = null;

/**
* @var WireInputVars|null
* @var WireInputData|null
*
*/
protected $whitelist = null;
Expand Down Expand Up @@ -598,17 +598,19 @@ public function scheme() {
* - OPTIONS
* - or blank if not known
*
* @return string
* @param string $method Optionally enter the request method to return bool if current method matches
* @return string|bool
* @since 3.0.39
*
*/
public function requestMethod() {
public function requestMethod($method = '') {
if(isset($_SERVER['REQUEST_METHOD'])) {
$m = strtoupper($_SERVER['REQUEST_METHOD']);
$requestMethod = isset($this->requestMethods[$m]) ? $this->requestMethods[$m] : '';
} else {
$requestMethod = '';
}
if($method) return strtoupper($method) === $requestMethod;
return $requestMethod;
}

Expand Down
27 changes: 14 additions & 13 deletions wire/modules/Inputfield/InputfieldPage/InputfieldPage.module
Original file line number Diff line number Diff line change
Expand Up @@ -1167,20 +1167,21 @@ class InputfieldPage extends Inputfield implements ConfigurableModule {
$field->addOption($multiLabel, $multiples);
$field->addOption($multiLabel . ' (' . $this->_('sortable') . ')', $sortables);
$inputfields->insertBefore($field, $selectablePagesFieldset);

$f = $this->modules->get('InputfieldMarkup');
$f->label = $this->_('Regarding “Page List” input types');
$f->icon = 'warning';
$f->showIf = 'inputfield=' . implode('|', $pageListTypes);
$f->value = '<p>' .
$this->_('You have selected an input type that has specific requirements.') . ' ' .
$this->_('Specify only the “Parent” option below when configuring “Selectable pages”.') . ' ' .
$this->_('Note that the parent you specify implies the root of the tree of selectable pages.') .
$this->_('If you want to make everything selectable, then specify nothing.') .
'</p>';
$inputfields->insertAfter($f, $field);


if($this->hasFieldtype !== false) {

$f = $this->modules->get('InputfieldMarkup');
$f->label = $this->_('Regarding “Page List” input types');
$f->icon = 'warning';
$f->showIf = 'inputfield=' . implode('|', $pageListTypes);
$f->value = '<p>' .
$this->_('You have selected an input type that has specific requirements.') . ' ' .
$this->_('Specify only the “Parent” option below when configuring “Selectable pages”.') . ' ' .
$this->_('Note that the parent you specify implies the root of the tree of selectable pages.') .
$this->_('If you want to make everything selectable, then specify nothing.') .
'</p>';
$inputfields->insertAfter($f, $field);

$field = $this->modules->get('InputfieldCheckbox');
$field->attr('name', 'addable');
$field->attr('value', 1);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,6 @@
* @property bool $allowSubfieldGroups [true] Allow @grouping of subfields (like for page references)?
* @property bool $allowModifiers [true] Allow use of modifiers like include, limit?
* @property bool $allowBlankValues [false] When no value is present, should it contribute to the selector?
* @property bool $showInitValue [false] Show non-modifiable inputs for the initValue?
* @property bool|int $showFieldLabels [false] Show field labels rather than names? Or specify integer 2 to show both.
* @property bool $showOptgroups [true] Whether or not to separate sytem, field, subfields, etc. into their own optgroups. If turned off, all types of fields will be shown together A-Z.
* @property array $limitFields [empty] Selectable fields whitelist (field names). Leave empty to allow any.
Expand Down Expand Up @@ -192,7 +191,6 @@ class InputfieldSelector extends Inputfield implements ConfigurableModule {
$this->setting('allowSubfieldGroups', true);
$this->setting('allowModifiers', true);
$this->setting('allowBlankValues', false); // blank values are allowed in selector or if not present, blank values allowed and represented by =""
$this->setting('showInitValue', false); // whether or not inputs for the initValue should be shown (they won't be modifyable if shown)
$this->setting('showFieldLabels', false); // makes it use field labels, rather than names (when true)
$this->setting('showOptgroups', true); // show option groups to separate system, field, subfield, etc.
$this->setting('optgroupsOrder', 'system,field,subfield,group,modifier,adjust'); // field selection option groups and order to render them in (applicable only if showOptgroups=true)
Expand Down

0 comments on commit 65eb8da

Please sign in to comment.