class Overview

Same name in other branches
  1. 9 core/modules/forum/src/Form/Overview.php \Drupal\forum\Form\Overview
  2. 8.9.x core/modules/forum/src/Form/Overview.php \Drupal\forum\Form\Overview
  3. 10 core/modules/forum/src/Form/Overview.php \Drupal\forum\Form\Overview

Provides forum overview form for the forum vocabulary.

@internal

Hierarchy

Expanded class hierarchy of Overview

6 string references to 'Overview'
content_moderation.links.task.yml in core/modules/content_moderation/content_moderation.links.task.yml
core/modules/content_moderation/content_moderation.links.task.yml
DbUpdateController::updateTasksList in core/modules/system/src/Controller/DbUpdateController.php
Provides the update task list render array.
forum.routing.yml in core/modules/forum/forum.routing.yml
core/modules/forum/forum.routing.yml
MigrateUpgradeFormBase::restartUpgradeForm in core/modules/migrate_drupal_ui/src/Form/MigrateUpgradeFormBase.php
Helper to redirect to the Overview form.
MigrateUpgradeFormStepsTest::testMigrateUpgradeReviewPage in core/modules/migrate_drupal_ui/tests/src/Functional/MigrateUpgradeFormStepsTest.php
Tests the flow of the Migrate Drupal UI form.

... See full list

File

core/modules/forum/src/Form/Overview.php, line 17

Namespace

Drupal\forum\Form
View source
class Overview extends OverviewTerms {
    
    /**
     * {@inheritdoc}
     */
    public function getFormId() {
        return 'forum_overview';
    }
    
    /**
     * {@inheritdoc}
     */
    public function buildForm(array $form, FormStateInterface $form_state, VocabularyInterface $taxonomy_vocabulary = NULL) {
        $forum_config = $this->config('forum.settings');
        $vid = $forum_config->get('vocabulary');
        $vocabulary = $this->entityTypeManager
            ->getStorage('taxonomy_vocabulary')
            ->load($vid);
        if (!$vocabulary) {
            throw new NotFoundHttpException();
        }
        // Build base taxonomy term overview.
        $form = parent::buildForm($form, $form_state, $vocabulary);
        foreach (Element::children($form['terms']) as $key) {
            if (isset($form['terms'][$key]['#term'])) {
                
                /** @var \Drupal\taxonomy\TermInterface $term */
                $term = $form['terms'][$key]['#term'];
                $form['terms'][$key]['term']['#url'] = Url::fromRoute('forum.page', [
                    'taxonomy_term' => $term->id(),
                ]);
                if (!empty($term->forum_container->value)) {
                    $title = $this->t('edit container');
                    $url = Url::fromRoute('entity.taxonomy_term.forum_edit_container_form', [
                        'taxonomy_term' => $term->id(),
                    ]);
                }
                else {
                    $title = $this->t('edit forum');
                    $url = Url::fromRoute('entity.taxonomy_term.forum_edit_form', [
                        'taxonomy_term' => $term->id(),
                    ]);
                }
                // Re-create the operations column and add only the edit link.
                $form['terms'][$key]['operations'] = [
                    '#type' => 'operations',
                    '#links' => [
                        'edit' => [
                            'title' => $title,
                            'url' => $url,
                        ],
                    ],
                ];
            }
        }
        // Remove the alphabetical reset.
        unset($form['actions']['reset_alphabetical']);
        // Use the existing taxonomy overview submit handler.
        $form['terms']['#empty'] = $this->t('No containers or forums available. <a href=":container">Add container</a> or <a href=":forum">Add forum</a>.', [
            ':container' => Url::fromRoute('forum.add_container')->toString(),
            ':forum' => Url::fromRoute('forum.add_forum')->toString(),
        ]);
        return $form;
    }

}

Members

Title Sort descending Modifiers Object type Summary Overriden Title Overrides
DependencySerializationTrait::$_entityStorages protected property
DependencySerializationTrait::$_serviceIds protected property
DependencySerializationTrait::__sleep public function 1
DependencySerializationTrait::__wakeup public function 2
FormBase::$configFactory protected property The config factory. 2
FormBase::$requestStack protected property The request stack. 1
FormBase::$routeMatch protected property The route match.
FormBase::config protected function Retrieves a configuration object.
FormBase::configFactory protected function Gets the config factory for this form. 2
FormBase::container private function Returns the service container.
FormBase::currentUser protected function Gets the current user. 2
FormBase::getRequest protected function Gets the request object.
FormBase::getRouteMatch protected function Gets the route match.
FormBase::logger protected function Gets the logger for a specific channel.
FormBase::redirect protected function Returns a redirect response object for the specified route.
FormBase::resetConfigFactory public function Resets the configuration factory.
FormBase::setConfigFactory public function Sets the config factory for this form.
FormBase::setRequestStack public function Sets the request stack object to use.
FormBase::validateForm public function Form validation handler. Overrides FormInterface::validateForm 57
LoggerChannelTrait::$loggerFactory protected property The logger channel factory service.
LoggerChannelTrait::getLogger protected function Gets the logger for a specific channel.
LoggerChannelTrait::setLoggerFactory public function Injects the logger channel factory.
MessengerTrait::$messenger protected property The messenger. 16
MessengerTrait::messenger public function Gets the messenger. 16
MessengerTrait::setMessenger public function Sets the messenger.
Overview::buildForm public function Form constructor. Overrides OverviewTerms::buildForm
Overview::getFormId public function Returns a unique string identifying the form. Overrides OverviewTerms::getFormId
OverviewTerms::$entityRepository protected property The entity repository.
OverviewTerms::$entityTypeManager protected property The entity type manager.
OverviewTerms::$moduleHandler protected property The module handler service.
OverviewTerms::$pagerManager protected property The pager manager.
OverviewTerms::$renderer protected property The renderer service.
OverviewTerms::$storageController protected property The term storage handler.
OverviewTerms::$termListBuilder protected property The term list builder.
OverviewTerms::create public static function Instantiates a new instance of this class. Overrides FormBase::create
OverviewTerms::submitForm public function Form submission handler. Overrides FormInterface::submitForm
OverviewTerms::submitReset public function Redirects to confirmation form for the reset action.
OverviewTerms::__construct public function Constructs an OverviewTerms object.
RedirectDestinationTrait::$redirectDestination protected property The redirect destination service. 2
RedirectDestinationTrait::getDestinationArray protected function Prepares a &#039;destination&#039; URL query parameter for use with \Drupal\Core\Url.
RedirectDestinationTrait::getRedirectDestination protected function Returns the redirect destination service.
RedirectDestinationTrait::setRedirectDestination public function Sets the redirect destination service.
StringTranslationTrait::$stringTranslation protected property The string translation service. 3
StringTranslationTrait::formatPlural protected function Formats a string containing a count of items.
StringTranslationTrait::getNumberOfPlurals protected function Returns the number of plurals supported by a given language.
StringTranslationTrait::getStringTranslation protected function Gets the string translation service.
StringTranslationTrait::setStringTranslation public function Sets the string translation service to use. 2
StringTranslationTrait::t protected function Translates a string to the current language or to a given language.

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.