class Overview in Drupal 9
Same name and namespace in other branches
- 8 core/modules/forum/src/Form/Overview.php \Drupal\forum\Form\Overview
Provides forum overview form for the forum vocabulary.
@internal
Hierarchy
- class \Drupal\Core\Form\FormBase implements ContainerInjectionInterface, FormInterface uses DependencySerializationTrait, LoggerChannelTrait, MessengerTrait, RedirectDestinationTrait, StringTranslationTrait
- class \Drupal\taxonomy\Form\OverviewTerms
- class \Drupal\forum\Form\Overview
- class \Drupal\taxonomy\Form\OverviewTerms
Expanded class hierarchy of Overview
3 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
File
- core/
modules/ forum/ src/ Form/ Overview.php, line 17
Namespace
Drupal\forum\FormView 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
Name | Modifiers | Type | Description | Overrides |
---|---|---|---|---|
DependencySerializationTrait:: |
protected | property | ||
DependencySerializationTrait:: |
protected | property | ||
DependencySerializationTrait:: |
public | function | 2 | |
DependencySerializationTrait:: |
public | function | 2 | |
FormBase:: |
protected | property | The config factory. | 3 |
FormBase:: |
protected | property | The request stack. | 1 |
FormBase:: |
protected | property | The route match. | |
FormBase:: |
protected | function | Retrieves a configuration object. | |
FormBase:: |
protected | function | Gets the config factory for this form. | 3 |
FormBase:: |
private | function | Returns the service container. | |
FormBase:: |
protected | function | Gets the current user. | |
FormBase:: |
protected | function | Gets the request object. | |
FormBase:: |
protected | function | Gets the route match. | |
FormBase:: |
protected | function | Gets the logger for a specific channel. | |
FormBase:: |
protected | function | Returns a redirect response object for the specified route. | |
FormBase:: |
public | function | Resets the configuration factory. | |
FormBase:: |
public | function | Sets the config factory for this form. | |
FormBase:: |
public | function | Sets the request stack object to use. | |
FormBase:: |
public | function |
Form validation handler. Overrides FormInterface:: |
72 |
LoggerChannelTrait:: |
protected | property | The logger channel factory service. | |
LoggerChannelTrait:: |
protected | function | Gets the logger for a specific channel. | |
LoggerChannelTrait:: |
public | function | Injects the logger channel factory. | |
MessengerTrait:: |
protected | property | The messenger. | 27 |
MessengerTrait:: |
public | function | Gets the messenger. | 27 |
MessengerTrait:: |
public | function | Sets the messenger. | |
Overview:: |
public | function |
Form constructor. Overrides OverviewTerms:: |
|
Overview:: |
public | function |
Returns a unique string identifying the form. Overrides OverviewTerms:: |
|
OverviewTerms:: |
protected | property | The entity repository. | |
OverviewTerms:: |
protected | property | The entity type manager. | |
OverviewTerms:: |
protected | property | The module handler service. | |
OverviewTerms:: |
protected | property | The pager manager. | |
OverviewTerms:: |
protected | property | The renderer service. | |
OverviewTerms:: |
protected | property | The term storage handler. | |
OverviewTerms:: |
protected | property | The term list builder. | |
OverviewTerms:: |
public static | function |
Instantiates a new instance of this class. Overrides FormBase:: |
|
OverviewTerms:: |
public | function |
Form submission handler. Overrides FormInterface:: |
|
OverviewTerms:: |
public | function | Redirects to confirmation form for the reset action. | |
OverviewTerms:: |
public | function | Constructs an OverviewTerms object. | |
RedirectDestinationTrait:: |
protected | property | The redirect destination service. | 1 |
RedirectDestinationTrait:: |
protected | function | Prepares a 'destination' URL query parameter for use with \Drupal\Core\Url. | |
RedirectDestinationTrait:: |
protected | function | Returns the redirect destination service. | |
RedirectDestinationTrait:: |
public | function | Sets the redirect destination service. | |
StringTranslationTrait:: |
protected | property | The string translation service. | 4 |
StringTranslationTrait:: |
protected | function | Formats a string containing a count of items. | |
StringTranslationTrait:: |
protected | function | Returns the number of plurals supported by a given language. | |
StringTranslationTrait:: |
protected | function | Gets the string translation service. | |
StringTranslationTrait:: |
public | function | Sets the string translation service to use. | 2 |
StringTranslationTrait:: |
protected | function | Translates a string to the current language or to a given language. |