2015-10-15 12:25:38 +02:00
|
|
|
<?php
|
|
|
|
|
2015-11-08 12:40:14 +01:00
|
|
|
/**
|
|
|
|
* Plugin addlink_toolbar.
|
|
|
|
* Adds the addlink input on the linklist page.
|
|
|
|
*/
|
|
|
|
|
2023-05-24 11:35:15 +02:00
|
|
|
use Shaarli\Render\TemplatePage;
|
2018-12-04 00:02:17 +01:00
|
|
|
|
2015-10-15 12:25:38 +02:00
|
|
|
/**
|
|
|
|
* When linklist is displayed, add play videos to header's toolbar.
|
|
|
|
*
|
|
|
|
* @param array $data - header data.
|
2015-11-08 12:40:14 +01:00
|
|
|
*
|
2015-10-15 12:25:38 +02:00
|
|
|
* @return mixed - header data with addlink toolbar item.
|
|
|
|
*/
|
2015-11-08 12:40:14 +01:00
|
|
|
function hook_addlink_toolbar_render_header($data)
|
|
|
|
{
|
2023-05-24 11:35:15 +02:00
|
|
|
if ($data['_PAGE_'] == TemplatePage::LINKLIST && $data['_LOGGEDIN_'] === true) {
|
|
|
|
$form = [
|
|
|
|
'attr' => [
|
2016-12-01 11:38:21 +01:00
|
|
|
'method' => 'GET',
|
2023-05-24 11:35:15 +02:00
|
|
|
'action' => $data['_BASE_PATH_'] . '/admin/shaare',
|
2016-12-01 11:38:21 +01:00
|
|
|
'name' => 'addform',
|
|
|
|
'class' => 'addform',
|
2023-05-24 11:35:15 +02:00
|
|
|
],
|
|
|
|
'inputs' => [
|
|
|
|
[
|
2016-12-01 11:38:21 +01:00
|
|
|
'type' => 'text',
|
|
|
|
'name' => 'post',
|
2017-05-09 18:12:15 +02:00
|
|
|
'placeholder' => t('URI'),
|
2023-05-24 11:35:15 +02:00
|
|
|
],
|
|
|
|
[
|
2016-12-01 11:38:21 +01:00
|
|
|
'type' => 'submit',
|
2017-05-09 18:12:15 +02:00
|
|
|
'value' => t('Add link'),
|
2016-12-01 11:38:21 +01:00
|
|
|
'class' => 'bigbutton',
|
2023-05-24 11:35:15 +02:00
|
|
|
],
|
|
|
|
],
|
|
|
|
];
|
2016-12-01 11:38:21 +01:00
|
|
|
$data['fields_toolbar'][] = $form;
|
2015-10-15 12:25:38 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
return $data;
|
|
|
|
}
|
2017-05-09 18:12:15 +02:00
|
|
|
|
|
|
|
/**
|
|
|
|
* This function is never called, but contains translation calls for GNU gettext extraction.
|
|
|
|
*/
|
|
|
|
function addlink_toolbar_dummy_translation()
|
|
|
|
{
|
|
|
|
// meta
|
|
|
|
t('Adds the addlink input on the linklist page.');
|
|
|
|
}
|