🇫🇷France @Tritof

Account created on 3 February 2011, almost 14 years ago
#

Recent comments

🇫🇷France Tritof

I join you in this request @zenimage.
In the meantime, I've used this piece of code that responded to the need. There is probably a better way to do it, but this works.
Basically, it compares current user roles with an array of roles that aren't allowed to vote. If there is any match, it removes the poll and just exposes the results instead.

/**
 * Implements hook_form_FORM_ID_alter for polls.
 */
function customer_specifics_form_poll_view_form_alter(&$form, FormStateInterface $form_state, $form_id): void {
  $currentUserRoles = \Drupal::currentUser()->getRoles();
  $roles = ['role_1', 'role_2'];
  $diff = array_intersect($currentUserRoles, $roles);
  if(!empty($diff)) {
    $poll = \Drupal::entityTypeManager()->getStorage('poll')->load(substr($form_id, -1));
    $pollViewForm = \Drupal::service('class_resolver')->getInstanceFromDefinition(PollViewForm::class);
    $results = $pollViewForm->showPollResults($poll);
    $form['choice'] = [];
    $form['actions'] = [];
    $form['results'] =  $results;
  }
}
🇫🇷France Tritof

Thanks for this patch, I have used it successfully on a Drupal 8.9 version on PHP 7.2.
The issue appeared after updating the module to the latest version.

🇫🇷France Tritof

Hi,
I have successfully used the patch #5 on a D9 version freshly upgraded from D8, on PHP 8.1.13, local windows env.
The issue appeared just after upgrading both drupal (8 to 9) and PHP (7.4 to 8.1), with Bootstrap 8.x-3.24, still present after upgrading to 8.x-3.28.
Thanks to the patch, the issue is now resolved in my case.
BR

🇫🇷France Tritof

Hello,

After Upgrading Drupal 9.3 > 9.5 + modules, I had the same double warning issue :

  • User warning: The following theme is missing from the file system: jquery_ui_autocomplete in Drupal\Core\Extension\ExtensionPathResolver->getPathname() (line 63 of core/lib/Drupal/Core/Extension/ExtensionPathResolver.php).
  • Deprecated function: dirname(): Passing null to parameter #1 ($path) of type string is deprecated in Drupal\Core\Extension\ExtensionPathResolver->getPath() (line 85 of core/lib/Drupal/Core/Extension/ExtensionPathResolver.php).
  • User warning: The following theme is missing from the file system: jquery_ui_menu in Drupal\Core\Extension\ExtensionPathResolver->getPathname() (line 63 of core/lib/Drupal/Core/Extension/ExtensionPathResolver.php).
  • Deprecated function: dirname(): Passing null to parameter #1 ($path) of type string is deprecated in Drupal\Core\Extension\ExtensionPathResolver->getPath() (line 85 of core/lib/Drupal/Core/Extension/ExtensionPathResolver.php).

Both modules jquery_ui_autocomplete and jquery_ui_menu were required and downloaded during update without activation ( https://www.drupal.org/project/jquery_ui_autocomplete/issues/3328939 🐛 Missing Libraries file? Closed: works as designed ).

Once the modules activated, all the warnings disappeared, including "Deprecated function: dirname(): Passing null to parameter #1..."

Production build 0.71.5 2024