PLUGIN: addlink_toolbar

Add a field in linklist page to paste a new link.

Displayed in fields toolbar.
This commit is contained in:
ArthurHoaro 2015-10-15 12:25:38 +02:00
parent a52e843593
commit 1b2b44f4bd
3 changed files with 39 additions and 0 deletions

View file

@ -0,0 +1,4 @@
#addlink_toolbar {
display: inline;
margin: 0 0 0 25px;
}

View file

@ -0,0 +1,6 @@
<div id="addlink_toolbar">
<form method="GET" action="" name="addform" class="addform">
<input type="text" name="post" placeholder="URI">
<input type="submit" value="Add link" class="bigbutton">
</form>
</div>

View file

@ -0,0 +1,29 @@
<?php
/**
* When linklist is displayed, add play videos to header's toolbar.
*
* @param array $data - header data.
* @return mixed - header data with addlink toolbar item.
*/
function hook_addlink_toolbar_render_header($data) {
if ($data['_PAGE_'] == Router::$PAGE_LINKLIST && $data['_LOGGEDIN_'] === true) {
$data['fields_toolbar'][] = file_get_contents(PluginManager::$PLUGINS_PATH . '/addlink_toolbar/addlink_toolbar.html');
}
return $data;
}
/**
* When link list is displayed, include markdown CSS.
*
* @param array $data - includes data.
* @return mixed - includes data with markdown CSS file added.
*/
function hook_addlink_toolbar_render_includes($data) {
if ($data['_PAGE_'] == Router::$PAGE_LINKLIST && $data['_LOGGEDIN_'] === true) {
$data['css_files'][] = PluginManager::$PLUGINS_PATH . '/addlink_toolbar/addlink_toolbar.css';
}
return $data;
}