Unverified Commit 40d62a67 authored by Alex Pott's avatar Alex Pott
Browse files

Issue #3086794 by andypost, alexpott, jhodgdon, Amber Himes Matz, catch, xjm:...

Issue #3086794 by andypost, alexpott, jhodgdon, Amber Himes Matz, catch, xjm: Search results pages plugins could display results in administrative theme
parent 758adf0e
Loading
Loading
Loading
Loading
+7 −0
Original line number Diff line number Diff line
@@ -37,4 +37,11 @@ class SearchPlugin extends Plugin {
   */
  public $title;

  /**
   * Whether or not search results should be displayed in admin theme.
   *
   * @var bool
   */
  public $use_admin_theme = FALSE;

}
+11 −0
Original line number Diff line number Diff line
@@ -145,4 +145,15 @@ public function searchFormAlter(array &$form, FormStateInterface $form_state);
   */
  public function buildSearchUrlQuery(FormStateInterface $form_state);

  /**
   * Returns whether or not search results should be displayed in admin theme.
   *
   * @return bool
   *   TRUE if search results should be displayed in the admin theme, and FALSE
   *   otherwise.
   *
   * @see \Drupal\search\Annotation\SearchPlugin::$use_admin_theme
   */
  public function usesAdminTheme();

}
+7 −0
Original line number Diff line number Diff line
@@ -162,4 +162,11 @@ public function getHelp() {
    return $help;
  }

  /**
   * {@inheritdoc}
   */
  public function usesAdminTheme() {
    return $this->pluginDefinition['use_admin_theme'];
  }

}
+4 −0
Original line number Diff line number Diff line
@@ -110,6 +110,10 @@ public function routes() {
          ],
        ]
      );
      if ($entity->getPlugin()->usesAdminTheme()) {
        $routes["search.view_$entity_id"]->setOption('_admin_route', TRUE);
        $routes["search.help_$entity_id"]->setOption('_admin_route', TRUE);
      }
    }
    return $routes;
  }
+2 −1
Original line number Diff line number Diff line
@@ -12,7 +12,8 @@
 *
 * @SearchPlugin(
 *   id = "search_extra_type_search",
 *   title = @Translation("Dummy search type")
 *   title = @Translation("Dummy search type"),
 *   use_admin_theme = TRUE,
 * )
 */
class SearchExtraTypeSearch extends ConfigurableSearchPluginBase {
Loading