Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
37 changes: 0 additions & 37 deletions front/commondropdown.form.php

This file was deleted.

37 changes: 0 additions & 37 deletions front/commondropdown.php

This file was deleted.

6 changes: 4 additions & 2 deletions templates/container.class.tpl
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
<?php

use Glpi\DBAL\QueryParam;

class %%CLASSNAME%% extends PluginFieldsAbstractContainerInstance
{
static $rightname = '%%ITEMTYPE_RIGHT%%';
Expand Down Expand Up @@ -51,7 +53,7 @@ class %%CLASSNAME%% extends PluginFieldsAbstractContainerInstance
* This block ensures that the 'entities_id' field is created and populated if it
* associated item type requires entity assignment
*/
if (getItemForItemtype('%%ITEMTYPE%%')->isEntityAssign() && !$DB->fieldExists($table, 'entities_id')) {
if (getItemForItemtype(%%ITEMTYPE%%::class)->isEntityAssign() && !$DB->fieldExists($table, 'entities_id')) {
$migration->addField($table, 'entities_id', 'fkey', ['after' => 'plugin_fields_containers_id']);
$migration->addKey($table, 'entities_id');
$migration->executeMigration();
Expand Down Expand Up @@ -107,7 +109,7 @@ class %%CLASSNAME%% extends PluginFieldsAbstractContainerInstance
* associated item type requires recursive assignment
*/
if (
getItemForItemtype('%%ITEMTYPE%%')->maybeRecursive()
getItemForItemtype(%%ITEMTYPE%%::class)->maybeRecursive()
&& !$DB->fieldExists($table, 'is_recursive')
&& $DB->fieldExists($table, 'entities_id')) {
$migration->addField($table, 'is_recursive', 'bool', ['after' => 'entities_id']);
Expand Down
44 changes: 2 additions & 42 deletions templates/dropdown.class.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -59,9 +59,7 @@ class %%CLASSNAME%% extends CommonTreeDropdown {
* @param $full path or relative one (true by default)
**/
static function getTabsURL($full=true) {
$url = Toolbox::getItemTypeTabsURL('PluginFieldsCommonDropdown', $full);
$plug = isPluginItemType(get_called_class());
$url .= '?ddtype=' . strtolower($plug['class']);
$url = Toolbox::getItemTypeTabsURL(get_called_class(), $full);
return $url;
}

Expand All @@ -71,45 +69,7 @@ class %%CLASSNAME%% extends CommonTreeDropdown {
* @param $full path or relative one (true by default)
**/
static function getSearchURL($full=true) {
$url = Toolbox::getItemTypeSearchURL('PluginFieldsCommonDropdown', $full);
$plug = isPluginItemType(get_called_class());
$url .= '?ddtype=' . strtolower($plug['class']);
$url = Toolbox::getItemTypeSearchURL(get_called_class(), $full);
return $url;
}

/**
* Get the form page URL for the current class
*
* @param $full path or relative one (true by default)
**/
static function getFormURL($full=true) {
$url = Toolbox::getItemTypeFormURL('PluginFieldsCommonDropdown', $full);
$plug = isPluginItemType(get_called_class());
$url .= '?ddtype=' . strtolower($plug['class']);
return $url;
}

/**
* Get the form page URL for the current class and point to a specific ID
*
* @param $id (default 0)
* @param $full path or relative one (true by default)
*
* @since version 0.90
**/
static function getFormURLWithID($id=0, $full=true) {

$link = self::getFormURL($full);
$link .= '&id=' . $id;
return $link;
}

/**
* Get default values to search engine to override
**/
static function getDefaultSearchRequest() {
$plug = isPluginItemType(get_called_class());
$search = ['addhidden' => ['ddtype' => strtolower($plug['class'])]];
return $search;
}
}
7 changes: 0 additions & 7 deletions templates/dropdown.form.tpl

This file was deleted.

6 changes: 0 additions & 6 deletions templates/dropdown.tpl

This file was deleted.