FilterInsertBlock.php in Insert Block 8
File
lib/Drupal/insert_block/Plugin/Filter/FilterInsertBlock.php
View source
<?php
namespace Drupal\insert_block\Plugin\Filter;
use Drupal\filter\Plugin\FilterBase;
class FilterInsertBlock extends FilterBase {
public function settingsForm(array $form, array &$form_state) {
$form['check_roles'] = array(
'#type' => 'checkbox',
'#title' => $this
->t('Check roles permissions.'),
'#default_value' => $this->settings['check_roles'],
'#description' => $this
->t('If user does not have permissions to view block it will be hidden.'),
);
return $form;
}
public function process($text, $langcode, $cache, $cache_id) {
return _insert_block($text, $this);
}
public function tips($long = FALSE) {
if ($long) {
return t('<a name="filter-insert_block"></a>You may use [block:<em>block_entity_id</em>] tags to display the contents of block. To discover block entity id, visit admin/structure/block and hover over a block\'s configure link and look in your browser\'s status bar. The last "word" you see is the block ID.');
}
else {
return t('You may use <a href="@insert_block_help">[block:<em>block_entity_id</em>] tags</a> to display the contents of block.', array(
"@insert_block_help" => url("filter/tips/filter_insert_block", array(
'fragment' => 'filter-insert_block',
)),
));
}
}
}