diff --git a/composer.json b/composer.json index 87ca610..f52ed8a 100644 --- a/composer.json +++ b/composer.json @@ -9,7 +9,7 @@ "source": "https://git.drupalcode.org/project/fivestar" }, "require": { - "drupal/core": "^9.2", + "drupal/core": "^9.2 || ^10", "drupal/votingapi": "^3.0" }, "minimum-stability": "dev" diff --git a/fivestar.info.yml b/fivestar.info.yml index 98a8b54..da7bb11 100644 --- a/fivestar.info.yml +++ b/fivestar.info.yml @@ -2,7 +2,7 @@ name: Fivestar type: module description: 'Enables fivestar ratings on content, users, etc.' package: Voting -core_version_requirement: ^9.2 +core_version_requirement: ^9.2 || ^10 dependencies: - votingapi:votingapi diff --git a/fivestar.module b/fivestar.module index dbc4e2c..4ad1917 100644 --- a/fivestar.module +++ b/fivestar.module @@ -78,17 +78,6 @@ function fivestar_theme() { 'microdata' => [], ], ], - 'fivestar_preview' => [ - 'function' => 'theme_fivestar_preview', - 'variables' => [ - 'style' => NULL, - 'text' => NULL, - 'stars' => NULL, - 'unvote' => NULL, - 'title' => NULL, - ], - 'file' => 'includes/fivestar.theme.inc', - ], 'fivestar_formatter_rating' => [ 'render element' => 'element', ], diff --git a/includes/fivestar.theme.inc b/includes/fivestar.theme.inc deleted file mode 100644 index e1cbda6..0000000 --- a/includes/fivestar.theme.inc +++ /dev/null @@ -1,44 +0,0 @@ - 50, - 'vote_user' => 80, - 'vote_count' => 20, - ]; - $settings = [ - 'stars' => $stars, - 'allow_clear' => $unvote, - 'allow_revote' => $revote, - 'allow_ownvote' => $ownvote, - 'style' => $style, - 'text' => $text, - 'title' => $title, - 'autosubmit' => FALSE, - 'vote_type' => 'vote', - ]; - - $form = drupal_get_form('fivestar_custom_widget', $values, $settings); - $form = \Drupal::service('renderer')->render($form); - // This regex is sadly necessary because having duplicate form_tokens or - // form_id elements can cause the content type form to choke. Forms inside of - // forms is also frowned upon, so this removes the wrapping form tag as well. - $form = str_replace([''], [ - '', - ], $form); - $form = preg_replace('/( method=".*?")|( action=".*?")|()/', '', $form); - return $form; -}