You are here

public function SourcePluginUiBase::overviewSearchFormPart in Translation Management Tool 8

Builds search form for entity sources overview.

Parameters

array $form: Drupal form array.

FormStateInterface $form_state: Drupal form_state array.

string $type: Entity type.

Return value

array Drupal form array.

4 calls to SourcePluginUiBase::overviewSearchFormPart()
ConfigSourcePluginUi::overviewSearchFormPart in sources/tmgmt_config/src/ConfigSourcePluginUi.php
Builds search form for entity sources overview.
ContentEntitySourcePluginUi::overviewSearchFormPart in sources/content/src/ContentEntitySourcePluginUi.php
Builds search form for entity sources overview.
LocaleSourcePluginUi::overviewSearchFormPart in sources/locale/src/LocaleSourcePluginUi.php
Builds search form for entity sources overview.
SourcePluginUiBase::overviewForm in src/SourcePluginUiBase.php
Builds the overview form for the source entities.
3 methods override SourcePluginUiBase::overviewSearchFormPart()
ConfigSourcePluginUi::overviewSearchFormPart in sources/tmgmt_config/src/ConfigSourcePluginUi.php
Builds search form for entity sources overview.
ContentEntitySourcePluginUi::overviewSearchFormPart in sources/content/src/ContentEntitySourcePluginUi.php
Builds search form for entity sources overview.
LocaleSourcePluginUi::overviewSearchFormPart in sources/locale/src/LocaleSourcePluginUi.php
Builds search form for entity sources overview.

File

src/SourcePluginUiBase.php, line 200

Class

SourcePluginUiBase
Default ui controller class for source plugin.

Namespace

Drupal\tmgmt

Code

public function overviewSearchFormPart(array $form, FormStateInterface $form_state, $type) {

  // Add entity type and plugin_id value into form array
  // so that it is available in the form alter hook.
  $form_state
    ->set('entity_type', $type);
  $form_state
    ->set('plugin_id', $this->pluginId);

  // Add search form specific styling.
  $form['#attached']['library'][] = 'tmgmt/source_search_form';
  $form['search_wrapper'] = array(
    '#prefix' => '<div class="tmgmt-sources-wrapper">',
    '#suffix' => '</div>',
    '#weight' => -15,
  );
  $form['search_wrapper']['search'] = array(
    '#tree' => TRUE,
  );
  $form['search_wrapper']['search_submit'] = array(
    '#type' => 'submit',
    '#value' => t('Search'),
    '#weight' => 90,
  );
  $form['search_wrapper']['search_cancel'] = array(
    '#type' => 'submit',
    '#value' => t('Cancel'),
    '#weight' => 100,
  );
  return $form;
}