mirror of
https://github.com/processwire/processwire.git
synced 2025-08-09 16:26:59 +02:00
Add a Template::editUrl() method
This commit is contained in:
@@ -4808,7 +4808,7 @@ class Modules extends WireArray {
|
|||||||
if($moduleVersions[$id] != $moduleInfo['version']) {
|
if($moduleVersions[$id] != $moduleInfo['version']) {
|
||||||
$fromVersion = $this->formatVersion($moduleVersions[$id]);
|
$fromVersion = $this->formatVersion($moduleVersions[$id]);
|
||||||
$toVersion = $this->formatVersion($moduleInfo['version']);
|
$toVersion = $this->formatVersion($moduleInfo['version']);
|
||||||
$versionChanges[] = "$moduleName: $fromVersion => $toVersion";
|
$versionChanges[] = "$fromVersion => $toVersion: $moduleName";
|
||||||
$this->modulesLastVersions[$id] = $moduleVersions[$id];
|
$this->modulesLastVersions[$id] = $moduleVersions[$id];
|
||||||
if(strpos($moduleName, 'Fieldtype') === 0) {
|
if(strpos($moduleName, 'Fieldtype') === 0) {
|
||||||
// apply update now, to Fieldtype modules only (since they are loaded differently)
|
// apply update now, to Fieldtype modules only (since they are loaded differently)
|
||||||
@@ -4864,7 +4864,7 @@ class Modules extends WireArray {
|
|||||||
'items' => $missModules,
|
'items' => $missModules,
|
||||||
),
|
),
|
||||||
array(
|
array(
|
||||||
'label' => $this->_('Found %d module version changes (applied when module is loaded):'),
|
'label' => $this->_('Found %d module version changes (applied when each module is loaded):'),
|
||||||
'items' => $versionChanges,
|
'items' => $versionChanges,
|
||||||
),
|
),
|
||||||
);
|
);
|
||||||
|
@@ -110,6 +110,7 @@
|
|||||||
* @property string $pageLabelField CSV or space separated string of field names to be displayed by ProcessPageList (overrides those set with ProcessPageList config). #pw-group-other
|
* @property string $pageLabelField CSV or space separated string of field names to be displayed by ProcessPageList (overrides those set with ProcessPageList config). #pw-group-other
|
||||||
* @property int|bool $_importMode Internal use property set by template importer when importing #pw-internal
|
* @property int|bool $_importMode Internal use property set by template importer when importing #pw-internal
|
||||||
* @property int|null $connectedFieldID ID of connected field or null or 0 if not applicable. #pw-internal
|
* @property int|null $connectedFieldID ID of connected field or null or 0 if not applicable. #pw-internal
|
||||||
|
* @property string $editUrl URL to edit template, for administrator. #pw-internal
|
||||||
*
|
*
|
||||||
* Hookable methods
|
* Hookable methods
|
||||||
*
|
*
|
||||||
@@ -310,14 +311,15 @@ class Template extends WireData implements Saveable, Exportable {
|
|||||||
*/
|
*/
|
||||||
public function get($key) {
|
public function get($key) {
|
||||||
|
|
||||||
if($key == 'filename') return $this->filename();
|
if($key === 'filename') return $this->filename();
|
||||||
if($key == 'fields') $key = 'fieldgroup';
|
if($key === 'fields') $key = 'fieldgroup';
|
||||||
if($key == 'fieldgroup') return $this->fieldgroup;
|
if($key === 'fieldgroup') return $this->fieldgroup;
|
||||||
if($key == 'fieldgroupPrevious') return $this->fieldgroupPrevious;
|
if($key === 'fieldgroupPrevious') return $this->fieldgroupPrevious;
|
||||||
if($key == 'roles') return $this->getRoles();
|
if($key === 'roles') return $this->getRoles();
|
||||||
if($key == 'cacheTime') $key = 'cache_time'; // for camel case consistency
|
if($key === 'cacheTime') $key = 'cache_time'; // for camel case consistency
|
||||||
if($key == 'icon') return $this->getIcon();
|
if($key === 'icon') return $this->getIcon();
|
||||||
if($key == 'urlSegments') return $this->urlSegments();
|
if($key === 'urlSegments') return $this->urlSegments();
|
||||||
|
if($key === 'editUrl') return $this->editUrl();
|
||||||
|
|
||||||
return isset($this->settings[$key]) ? $this->settings[$key] : parent::get($key);
|
return isset($this->settings[$key]) ? $this->settings[$key] : parent::get($key);
|
||||||
}
|
}
|
||||||
@@ -1452,6 +1454,18 @@ class Template extends WireData implements Saveable, Exportable {
|
|||||||
return $field;
|
return $field;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* URL to edit template settings (for administrator)
|
||||||
|
*
|
||||||
|
* @param bool $http Full http/https URL?
|
||||||
|
* @return string
|
||||||
|
* @since 3.0.170
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
public function editUrl($http = false) {
|
||||||
|
return $this->wire()->config->urls($http ? 'httpAdmin' : 'admin') . "setup/template/edit?id=$this->id";
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Ensures that isset() and empty() work for this classes properties.
|
* Ensures that isset() and empty() work for this classes properties.
|
||||||
*
|
*
|
||||||
|
Reference in New Issue
Block a user