record_shorten_views_handler_field_hostname.php in Shorten URLs 8.2
File
modules/record_shorten/src/record_shorten_views_handler_field_hostname.php
View source
<?php
namespace Drupal\record_shorten;
class RecordShortenViewsHandlerFieldHostname extends views_handler_field {
public function optionsForm(&$form, &$form_state) {
parent::optionsForm($form, $form_state);
$form['notice'] = [
'#value' => '<p class="form-item"><strong>' . t('Users must have both the "administer users" and "access site reports" permission to view this field.') . '</strong></p>',
'#weight' => -10,
];
}
public function render($values) {
if (!\Drupal::currentUser()
->hasPermission('administer users') || !\Drupal::currentUser()
->hasPermission('access site reports')) {
return;
}
return parent::render($values);
}
}