phpmyadmin/libraries/classes/Navigation/Nodes/NodeDatabaseChild.php
Kamil Tekiela 902d1a1e77
Add native return type hints (#18126)
* Add remaining native return type hints to flush out bugs

Signed-off-by: Kamil Tekiela <tekiela246@gmail.com>

* Cast the mixed value to int

Signed-off-by: Kamil Tekiela <tekiela246@gmail.com>

* Fix tests

Signed-off-by: Kamil Tekiela <tekiela246@gmail.com>

* getAutoIncrement() is supposed to return string

Signed-off-by: Kamil Tekiela <tekiela246@gmail.com>

* Cast values to string in DummyResult

Signed-off-by: Kamil Tekiela <tekiela246@gmail.com>

* Make getCollation() return non-nullable string

Signed-off-by: Kamil Tekiela <tekiela246@gmail.com>

* Cast seqInIndex to int

Signed-off-by: Kamil Tekiela <tekiela246@gmail.com>

* Cast $cardinality to int

Signed-off-by: Kamil Tekiela <tekiela246@gmail.com>

* createFile may return false

Signed-off-by: Kamil Tekiela <tekiela246@gmail.com>

* Remove redundant cast

Signed-off-by: Kamil Tekiela <tekiela246@gmail.com>

* Update baselines

Signed-off-by: Kamil Tekiela <tekiela246@gmail.com>

---------

Signed-off-by: Kamil Tekiela <tekiela246@gmail.com>
2023-02-23 15:43:36 -03:00

57 lines
1.5 KiB
PHP

<?php
/**
* Functionality for the navigation tree
*/
declare(strict_types=1);
namespace PhpMyAdmin\Navigation\Nodes;
use PhpMyAdmin\Html\Generator;
use PhpMyAdmin\Url;
use function __;
/**
* Represents a node that is a child of a database node
* This may either be a concrete child such as table or a container
* such as table container
*/
abstract class NodeDatabaseChild extends Node
{
/**
* Returns the type of the item represented by the node.
*
* @return string type of the item
*/
abstract protected function getItemType(): string;
/**
* Returns HTML for control buttons displayed infront of a node
*
* @return string HTML for control buttons
*/
public function getHtmlForControlButtons(): string
{
$ret = '';
$relationParameters = $this->relation->getRelationParameters();
if ($relationParameters->navigationItemsHidingFeature !== null) {
$params = [
'hideNavItem' => true,
'itemType' => $this->getItemType(),
'itemName' => $this->realName,
'dbName' => $this->realParent()->realName,
];
$ret = '<span class="navItemControls">'
. '<a href="' . Url::getFromRoute('/navigation') . '" data-post="'
. Url::getCommon($params, '', false) . '"'
. ' class="hideNavItem ajax">'
. Generator::getImage('hide', __('Hide'))
. '</a></span>';
}
return $ret;
}
}