Skip to content

Commit

Permalink
Add className to getInstanceForNewNode
Browse files Browse the repository at this point in the history
Signed-off-by: William Desportes <williamdes@wdes.fr>
  • Loading branch information
williamdes committed Dec 29, 2019
1 parent 761e37e commit d018fd9
Show file tree
Hide file tree
Showing 10 changed files with 21 additions and 19 deletions.
5 changes: 4 additions & 1 deletion libraries/classes/Navigation/NodeFactory.php
Expand Up @@ -94,14 +94,17 @@ public static function getInstance(
* Instantiates a Node object that will be used only for "New db/table/etc.." objects
*
* @param string $name An identifier for the new node
* @param string $classes Extra CSS classes for the node
*
* @return Node
*/
public static function getInstanceForNewNode(
string $name
string $name,
string $classes
): Node {
$node = new Node($name, Node::OBJECT, false);
$node->isNew = true;
$node->classes = $classes;
return $node;
}
}
4 changes: 2 additions & 2 deletions libraries/classes/Navigation/Nodes/NodeColumnContainer.php
Expand Up @@ -42,7 +42,8 @@ public function __construct()

$newLabel = _pgettext('Create new column', 'New');
$new = NodeFactory::getInstanceForNewNode(
$newLabel
$newLabel,
'new_column italics'
);
$new->icon = Generator::getImage('b_column_add', $newLabel);
$new->links = [
Expand All @@ -57,7 +58,6 @@ public function __construct()
'after_field' => '',
]) . '&amp;db=%3$s&amp;table=%2$s',
];
$new->classes = 'new_column italics';
$this->addChild($new);
}
}
4 changes: 2 additions & 2 deletions libraries/classes/Navigation/Nodes/NodeDatabaseContainer.php
Expand Up @@ -36,14 +36,14 @@ public function __construct($name)
&& $GLOBALS['cfg']['ShowCreateDb'] !== false
) {
$new = NodeFactory::getInstanceForNewNode(
_pgettext('Create new database', 'New')
_pgettext('Create new database', 'New'),
'new_database italics'
);
$new->icon = Generator::getImage('b_newdb', '');
$new->links = [
'text' => Url::getFromRoute('/server/databases', ['server' => $GLOBALS['server']]),
'icon' => Url::getFromRoute('/server/databases', ['server' => $GLOBALS['server']]),
];
$new->classes = 'new_database italics';
$this->addChild($new);
}
}
Expand Down
4 changes: 2 additions & 2 deletions libraries/classes/Navigation/Nodes/NodeEventContainer.php
Expand Up @@ -37,7 +37,8 @@ public function __construct()
$this->realName = 'events';

$new = NodeFactory::getInstanceForNewNode(
_pgettext('Create new event', 'New')
_pgettext('Create new event', 'New'),
'new_event italics'
);
$new->icon = Generator::getImage('b_event_add', '');
$new->links = [
Expand All @@ -50,7 +51,6 @@ public function __construct()
'add_item' => 1,
]) . '&amp;db=%2$s',
];
$new->classes = 'new_event italics';
$this->addChild($new);
}
}
4 changes: 2 additions & 2 deletions libraries/classes/Navigation/Nodes/NodeFunctionContainer.php
Expand Up @@ -40,7 +40,8 @@ public function __construct()

$newLabel = _pgettext('Create new function', 'New');
$new = NodeFactory::getInstanceForNewNode(
$newLabel
$newLabel,
'new_function italics'
);
$new->icon = Generator::getImage('b_routine_add', $newLabel);
$new->links = [
Expand All @@ -55,7 +56,6 @@ public function __construct()
'add_item' => 1,
]) . '&amp;db=%2$s',
];
$new->classes = 'new_function italics';
$this->addChild($new);
}
}
4 changes: 2 additions & 2 deletions libraries/classes/Navigation/Nodes/NodeIndexContainer.php
Expand Up @@ -42,7 +42,8 @@ public function __construct()

$newLabel = _pgettext('Create new index', 'New');
$new = NodeFactory::getInstanceForNewNode(
$newLabel
$newLabel,
'new_index italics'
);
$new->icon = Generator::getImage('b_index_add', $newLabel);
$new->links = [
Expand All @@ -57,7 +58,6 @@ public function __construct()
'added_fields' => 2,
]) . '&amp;db=%3$s&amp;table=%2$s',
];
$new->classes = 'new_index italics';
$this->addChild($new);
}
}
Expand Up @@ -41,7 +41,7 @@ public function __construct()
$newLabel = _pgettext('Create new procedure', 'New');
$new = NodeFactory::getInstanceForNewNode(
$newLabel,
$newLabel
'new_procedure italics'
);
$new->icon = Generator::getImage('b_routine_add', $newLabel);
$new->links = [
Expand All @@ -54,7 +54,6 @@ public function __construct()
'add_item' => 1,
]) . '&amp;db=%2$s',
];
$new->classes = 'new_procedure italics';
$this->addChild($new);
}
}
4 changes: 2 additions & 2 deletions libraries/classes/Navigation/Nodes/NodeTableContainer.php
Expand Up @@ -43,7 +43,8 @@ public function __construct()

$newLabel = _pgettext('Create new table', 'New');
$new = NodeFactory::getInstanceForNewNode(
$newLabel
$newLabel,
'new_table italics'
);
$new->icon = Generator::getImage('b_table_add', $newLabel);
$new->links = [
Expand All @@ -54,7 +55,6 @@ public function __construct()
'server' => $GLOBALS['server'],
]) . '&amp;db=%2$s',
];
$new->classes = 'new_table italics';
$this->addChild($new);
}
}
4 changes: 2 additions & 2 deletions libraries/classes/Navigation/Nodes/NodeTriggerContainer.php
Expand Up @@ -37,7 +37,8 @@ public function __construct()
$this->realName = 'triggers';

$new = NodeFactory::getInstanceForNewNode(
_pgettext('Create new trigger', 'New')
_pgettext('Create new trigger', 'New'),
'new_trigger italics'
);
$new->icon = Generator::getImage('b_trigger_add', '');
$new->links = [
Expand All @@ -50,7 +51,6 @@ public function __construct()
'add_item' => 1,
]) . '&amp;db=%3$s',
];
$new->classes = 'new_trigger italics';
$this->addChild($new);
}
}
4 changes: 2 additions & 2 deletions libraries/classes/Navigation/Nodes/NodeViewContainer.php
Expand Up @@ -43,7 +43,8 @@ public function __construct()

$newLabel = _pgettext('Create new view', 'New');
$new = NodeFactory::getInstanceForNewNode(
$newLabel
$newLabel,
'new_view italics'
);
$new->icon = Generator::getImage('b_view_add', $newLabel);
$new->links = [
Expand All @@ -54,7 +55,6 @@ public function __construct()
'server' => $GLOBALS['server'],
]) . '&amp;db=%2$s',
];
$new->classes = 'new_view italics';
$this->addChild($new);
}
}

0 comments on commit d018fd9

Please sign in to comment.