You are here

class FederatedSearchPageFormBlock in Search API Federated Solr 8.2

Same name and namespace in other branches
  1. 8.3 src/Plugin/Block/FederatedSearchPageFormBlock.php \Drupal\search_api_federated_solr\Plugin\Block\FederatedSearchPageFormBlock
  2. 8 src/Plugin/Block/FederatedSearchPageFormBlock.php \Drupal\search_api_federated_solr\Plugin\Block\FederatedSearchPageFormBlock
  3. 4.x src/Plugin/Block/FederatedSearchPageFormBlock.php \Drupal\search_api_federated_solr\Plugin\Block\FederatedSearchPageFormBlock

Provides a "Federated Search Page Form" block.

Plugin annotation


@Block(
  id = "federated_search_page_form_block",
  admin_label = @Translation("Federated Search Page Form block"),
  category = @Translation("Federated Search"),
)

Hierarchy

Expanded class hierarchy of FederatedSearchPageFormBlock

File

src/Plugin/Block/FederatedSearchPageFormBlock.php, line 22

Namespace

Drupal\search_api_federated_solr\Plugin\Block
View source
class FederatedSearchPageFormBlock extends BlockBase implements BlockPluginInterface {

  /**
   * {@inheritdoc}
   */
  public function build() {
    $config = $this
      ->getConfiguration();
    $app_config = \Drupal::config('search_api_federated_solr.search_app.settings');
    $build = [
      '#theme' => 'search_api_federated_solr_block',
      '#search_form' => \Drupal::formBuilder()
        ->getForm('Drupal\\search_api_federated_solr\\Form\\FederatedSearchPageBlockForm'),
    ];

    // If autocomplete is enabled for this block, attach the js library.
    if (array_key_exists('autocomplete', $config) && array_key_exists('isEnabled', $config['autocomplete']) && $config['autocomplete']['isEnabled'] === 1) {

      // Attach autocomplete JS library.
      $build['#attached']['library'][] = 'search_api_federated_solr/search_form_autocomplete';

      // Cache autocomplete config.
      $autocomplete = $config['autocomplete'];
      $proxy_is_disabled = array_key_exists('proxyIsDisabled', $autocomplete) ? $autocomplete['proxyIsDisabled'] : 0;
      $direct_url = array_key_exists('directUrl', $autocomplete) ? $autocomplete['directUrl'] : '';

      // Determine the url that should be used for autocomplete.
      $autocomplete['url'] = Helpers::getEndpointUrl($proxy_is_disabled, $direct_url, '?q=[val]&wt=json');

      // Set the connstraints for allowed sites.
      if ($allowed_sites = $app_config
        ->get('facet.site_name.allowed_sites')) {
        $list = [];
        $sites = array_keys(array_filter($allowed_sites));
        foreach ($sites as $site) {
          $list[] = '"' . $site . '"';
        }
        $autocomplete['sm_site_name'] = '(' . implode(' OR ', $list) . ')';
      }

      // Write the block autocomplete config to Drupal settings.
      $build['#attached']['drupalSettings']['searchApiFederatedSolr'] = [
        'block' => [
          'autocomplete' => $autocomplete,
        ],
      ];

      // Add the js trigger class to the block.
      $build['#attributes']['class'][] = 'js-search-api-federated-solr-block-form-autocomplete';
    }
    return $build;
  }

  /**
   * {@inheritdoc}
   */
  public function blockForm($form, FormStateInterface $form_state) {
    $form = parent::blockForm($form, $form_state);

    // Create a link to the Search App Settings Page to be reused.
    $options = [
      'attributes' => [
        'target' => '_blank',
      ],
    ];
    $search_app_settings_page_url = Url::fromRoute('search_api_federated_solr.search_app.settings', [], $options);
    $search_app_settings_page_link = Link::fromTextAndUrl('Federated Search App settings page', $search_app_settings_page_url)
      ->toString();
    $config = $this
      ->getConfiguration();
    $index_options = [];
    $search_api_indexes = \Drupal::entityTypeManager()
      ->getStorage('search_api_index')
      ->loadMultiple();

    /* @var  $search_api_index \Drupal\search_api\IndexInterface */
    foreach ($search_api_indexes as $search_api_index) {
      $index_options[$search_api_index
        ->id()] = $search_api_index
        ->label();
    }

    /**
     * Autocomplete settings:
     *   - endpoint URL
     *   - use wildcard to support partial terms
     *   - customize number of autocomplete results
     *   - number of characters after which autocomplete query should be executed
     *   - autocomplete results mode (search results, terms)
     *   - title for autocomplete results
     *   - show/hide autocomplete keyboard directions
     */
    $form['autocomplete'] = [
      '#type' => 'details',
      '#title' => $this
        ->t('Federated Search Page Form Block > Search Form > Autocomplete'),
      '#description' => $this
        ->t('These options apply to the autocomplete functionality on the search form which appears on pages that render the Federated Search Page Form Block.  Configure the search results page search form functionality on the ' . $search_app_settings_page_link . '.'),
      '#open' => TRUE,
    ];
    $form['autocomplete']['autocomplete_is_enabled'] = [
      '#type' => 'checkbox',
      '#title' => '<b>' . $this
        ->t('Enable autocomplete for the search results page search form') . '</b>',
      '#default_value' => isset($config['autocomplete']['isEnabled']) ? $config['autocomplete']['isEnabled'] : 0,
      '#description' => $this
        ->t('Check this box to enable autocomplete on the federated search block search form and to expose more configuration options below.'),
      '#attributes' => [
        'data-autocomplete-enable' => TRUE,
      ],
    ];
    $form['autocomplete']['autocomplete_is_append_wildcard'] = [
      '#type' => 'checkbox',
      '#title' => '<b>' . $this
        ->t('Append a wildcard \'*\' to support partial text search') . '</b>',
      '#default_value' => isset($config['autocomplete']['appendWildcard']) ? $config['autocomplete']['appendWildcard'] : 0,
      '#description' => $this
        ->t('Check this box to append a wildcard * to the end of the autocomplete query term (i.e. "car" becomes "car*").  This option is only recommended if your solr config does not add a field(s) with <a href="https://lucene.apache.org/solr/guide/6_6/tokenizers.html" target="_blank">NGram Tokenizers</a> to your index or if your <a href="https://lucene.apache.org/solr/guide/6_6/requesthandlers-and-searchcomponents-in-solrconfig.html#RequestHandlersandSearchComponentsinSolrConfig-RequestHandlers" target="_blank">Request Handler</a> is not configured to search those fields.'),
      '#states' => [
        'visible' => [
          ':input[data-autocomplete-enable]' => [
            'checked' => TRUE,
          ],
        ],
      ],
    ];
    $form['autocomplete']['disable_query_proxy'] = [
      '#type' => 'checkbox',
      '#title' => '<b>' . $this
        ->t('Do not use the solr proxy for the autocomplete search query') . '</b>',
      '#default_value' => isset($config['autocomplete']['proxyIsDisabled']) ? $config['autocomplete']['proxyIsDisabled'] : 0,
      '#description' => $this
        ->t('Check this box to configure the block search form to query the Solr server directly. When checked, it is highly recommended that you also procure and configure read-only basic auth credentials for the search app. When unchecked, this site will act as a proxy for requests to the Solr server of the Search API index chosen on the ' . $search_app_settings_page_link . ' in Search Results Page > Set Up using the Drupal route defined by this module.<br/><br/>Note: Acquia Search customers must either leave this box unchecked or check the box and enter the URL for a view REST export endpoint.  Using a url pointing directly to your solr backend will not work.'),
      '#attributes' => [
        'data-autocomplete-direct' => TRUE,
      ],
      '#states' => [
        'visible' => [
          ':input[data-autocomplete-enable]' => [
            'checked' => TRUE,
          ],
        ],
      ],
    ];
    $form['autocomplete']['direct'] = [
      '#type' => 'fieldset',
      '#title' => $this
        ->t('Direct Query Settings'),
      '#states' => [
        'visible' => [
          ':input[data-autocomplete-enable]' => [
            'checked' => TRUE,
          ],
          ':input[data-autocomplete-direct]' => [
            'checked' => TRUE,
          ],
        ],
      ],
    ];
    $form['autocomplete']['direct']['autocomplete_url'] = [
      '#type' => 'textfield',
      '#title' => $this
        ->t('Endpoint URL'),
      '#default_value' => isset($config['autocomplete']['directUrl']) ? $config['autocomplete']['directUrl'] : '',
      '#maxlength' => 2048,
      '#size' => 50,
      '#description' => $this
        ->t('The URL where requests for autocomplete queries should be made. (Default: the url of the  <code>select</code> <a href="https://lucene.apache.org/solr/guide/6_6/requesthandlers-and-searchcomponents-in-solrconfig.html#RequestHandlersandSearchComponentsinSolrConfig-RequestHandlers" target="_blank">Request Handler</a> on the server of the selected Search API index.)<ul><li>Supports absolute url pattern to any endpoint which returns the expected response structure:
<pre><code>{
  response: {
   docs: [
     {
       ss_federated_title: [result title to be used as link text],
       ss_url: [result url to be used as link href],
     }
   ]
  }
}</code></pre></li><li>Include <code>[val]</code> in the URL to indicate where you would like the form value to be inserted: <code>http://d8.fs-demo.local/search-api-federated-solr-block-form-autocomplete/search-view?title=[val]&_format=json</code></li><li>Any facet/filter default values set for the search app will automatically be appended (i.e. <code>&sm_site_name=[value of the site name for the index]</code>)</li><li>Include any other necessary url params (like <code>&_format=json</code> if you are using a Views Rest Export or <code>&wt=json</code> if you are using a different Request Handler on your Solr index.</li>'),
      '#states' => [
        'visible' => [
          ':input[data-autocomplete-direct]' => [
            'checked' => TRUE,
          ],
        ],
      ],
    ];
    $form['autocomplete']['direct']['basic_auth'] = [
      '#type' => 'fieldset',
      '#title' => $this
        ->t('Search Form Autocomplete Basic Authentication'),
      '#description' => $this
        ->t('If your autocomplete endpoint is protected by basic HTTP authentication (highly recommended), enter the login data here. This will be accessible to the client in an obscured, but non-secure method. It should, therefore, only provide read access to the index AND be different from that provided when configuring the server in Search API. The Password field is intentionally not obscured to emphasize this distinction.'),
      '#states' => [
        'visible' => [
          ':input[data-autocomplete-direct]' => [
            'checked' => TRUE,
          ],
        ],
      ],
    ];
    $form['autocomplete']['direct']['basic_auth']['use_search_app_creds'] = [
      '#type' => 'checkbox',
      '#title' => $this
        ->t('Use credentials provided for Search Index Basic Authentication in Search Results Page > Set Up on ' . $search_app_settings_page_link),
      '#default_value' => isset($config['autocomplete']['use_search_app_creds']) ? $config['autocomplete']['use_search_app_creds'] : 0,
      '#attributes' => [
        'data-autocomplete-use-search-app-creds' => TRUE,
      ],
    ];
    $form['autocomplete']['direct']['basic_auth']['username'] = [
      '#type' => 'textfield',
      '#title' => $this
        ->t('Username'),
      '#default_value' => isset($config['autocomplete']['username']) ? $config['autocomplete']['username'] : '',
      '#states' => [
        'visible' => [
          ':input[data-autocomplete-use-search-app-creds]' => [
            'checked' => FALSE,
          ],
        ],
      ],
    ];
    $form['autocomplete']['direct']['basic_auth']['password'] = [
      '#type' => 'textfield',
      '#title' => $this
        ->t('Password'),
      '#default_value' => isset($config['autocomplete']['password']) ? $config['autocomplete']['password'] : '',
      '#states' => [
        'visible' => [
          ':input[data-autocomplete-use-search-app-creds]' => [
            'checked' => FALSE,
          ],
        ],
      ],
    ];
    $form['autocomplete']['autocomplete_suggestion_rows'] = [
      '#type' => 'number',
      '#title' => $this
        ->t('Number of results'),
      '#default_value' => isset($config['autocomplete']['suggestionRows']) ? $config['autocomplete']['suggestionRows'] : '',
      '#description' => $this
        ->t('The max number of results to render in the autocomplete results dropdown. (Default: 5)'),
      '#states' => [
        'visible' => [
          ':input[data-autocomplete-enable]' => [
            'checked' => TRUE,
          ],
        ],
      ],
    ];
    $form['autocomplete']['autocomplete_num_chars'] = [
      '#type' => 'number',
      '#title' => $this
        ->t('Number of characters after which autocomplete query should execute'),
      '#default_value' => isset($config['autocomplete']['numChars']) ? $config['autocomplete']['numChars'] : '',
      '#description' => $this
        ->t('Autocomplete query will be executed <em>after</em> a user types this many characters in the search query field. (Default: 2)'),
      '#states' => [
        'visible' => [
          ':input[data-autocomplete-enable]' => [
            'checked' => TRUE,
          ],
        ],
      ],
    ];
    $autocomplete_mode = isset($config['autocomplete']['mode']) ? $config['autocomplete']['mode'] : '';
    $form['autocomplete']['autocomplete_mode'] = [
      '#type' => 'select',
      '#title' => $this
        ->t('Autocomplete mode'),
      '#description' => $this
        ->t('Type of results the autocomplete response returns: search results (default) or search terms.'),
      '#options' => [
        'result' => $this
          ->t('Search results (i.e. search as you type functionality)'),
        'Search terms (coming soon)' => [],
      ],
      '#default_value' => isset($config['autocomplete']['mode']) ? $config['autocomplete']['mode'] : 'result',
      '#states' => [
        'visible' => [
          ':input[data-autocomplete-enable]' => [
            'checked' => TRUE,
          ],
        ],
      ],
    ];
    $form['autocomplete']['autocomplete_mode_title_text'] = [
      '#type' => 'textfield',
      '#title' => $this
        ->t('Results title text'),
      '#size' => 50,
      '#default_value' => $autocomplete_mode && isset($config['autocomplete'][$autocomplete_mode]['titleText']) ? $config['autocomplete'][$autocomplete_mode]['titleText'] : '',
      '#description' => $this
        ->t('The title text is shown above the results in the autocomplete drop down.  (Default: "What are you interested in?" for Search Results mode and "What would you like to search for?" for Search Term mode.)'),
      '#states' => [
        'visible' => [
          ':input[data-autocomplete-enable]' => [
            'checked' => TRUE,
          ],
        ],
      ],
    ];
    $form['autocomplete']['autocomplete_mode_hide_directions'] = [
      '#type' => 'checkbox',
      '#title' => '<b>' . $this
        ->t('Hide keyboard directions') . '</b>',
      '#default_value' => $autocomplete_mode && isset($config['autocomplete'][$autocomplete_mode]['hideDirectionsText']) ? $config['autocomplete'][$autocomplete_mode]['hideDirectionsText'] : 0,
      '#description' => $this
        ->t('Check this box to make hide the autocomplete keyboard usage directions in the results dropdown. For sites that want to maximize their accessibility UX for sighted keyboard users, we recommend leaving this unchecked. (Default: directions are visible)'),
      '#states' => [
        'visible' => [
          ':input[data-autocomplete-enable]' => [
            'checked' => TRUE,
          ],
        ],
      ],
    ];
    return $form;
  }

  /**
   * Validates that the provided autocomplete endpoint path is a valid relative or
   * absolute URL.
   *
   * @param array $form
   *   An associative array containing the structure of the form.
   * @param \Drupal\Core\Form\FormStateInterface $form_state
   *   The current state of the form.
   */
  public function blockValidate($form, FormStateInterface $form_state) {
    $key = [
      'autocomplete',
      'direct',
      'autocomplete_url',
    ];
    $path = $form_state
      ->getValue($key);
    $proxy_is_disabled = $form_state
      ->getValue([
      'autocomplete',
      'disable_query_proxy',
    ]);
    if ($path && $proxy_is_disabled) {
      if ($path !== '' && !UrlHelper::isValid($path, FALSE)) {
        $element['#parents'] = $key;
        $form_state
          ->setError($element, t('The URL %url is not valid.', array(
          '%url' => $path,
        )));
      }
    }
  }

  /**
   * {@inheritdoc}
   */
  public function blockSubmit($form, FormStateInterface $form_state) {
    parent::blockSubmit($form, $form_state);
    $values = $form_state
      ->getValues();

    // Define return object.
    $autocomplete = [];

    // Set autocomplete options.
    $autocomplete_is_enabled = $values['autocomplete']['autocomplete_is_enabled'];

    // If enabled, set the autocomplete options.
    if ($autocomplete_is_enabled) {

      // Cache form values that we'll use more than once.
      $autocomplete_mode = $values['autocomplete']['autocomplete_mode'];

      // Default to the form values
      $username = $values['autocomplete']['direct']['basic_auth']['username'];
      $password = $values['autocomplete']['direct']['basic_auth']['password'];
      $use_search_app_creds = $values['autocomplete']['direct']['basic_auth']['use_search_app_creds'];

      // Add basic auth credentials
      if ($use_search_app_creds) {
        $app_config = \Drupal::config('search_api_federated_solr.search_app.settings');
        $username = $app_config
          ->get('index.username');
        $password = $app_config
          ->get('index.password');
      }

      // Set the actual autocomplete config options.
      $autocomplete['isEnabled'] = $autocomplete_is_enabled;
      $autocomplete['proxyIsDisabled'] = $values['autocomplete']['disable_query_proxy'];
      $autocomplete['directUrl'] = $autocomplete['proxyIsDisabled'] ? $values['autocomplete']['direct']['autocomplete_url'] : '';
      $autocomplete['use_search_app_creds'] = $use_search_app_creds;
      if ($username) {
        $autocomplete['username'] = $username;
      }
      if ($password) {
        $autocomplete['password'] = $password;
      }
      if ($username && $password) {
        $autocomplete['userpass'] = base64_encode($username . ':' . $password);
      }
      if ($values['autocomplete']['autocomplete_is_append_wildcard']) {
        $autocomplete['appendWildcard'] = $values['autocomplete']['autocomplete_is_append_wildcard'];
      }
      if ($values['autocomplete']['autocomplete_suggestion_rows']) {
        $autocomplete['suggestionRows'] = $values['autocomplete']['autocomplete_suggestion_rows'];
      }
      if ($values['autocomplete']['autocomplete_num_chars']) {
        $autocomplete['numChars'] = $values['autocomplete']['autocomplete_num_chars'];
      }
      if ($autocomplete_mode) {
        $autocomplete['mode'] = $autocomplete_mode;
        if ($values['autocomplete']['autocomplete_mode_title_text']) {
          $autocomplete[$autocomplete_mode]['titleText'] = $values['autocomplete']['autocomplete_mode_title_text'];
        }
        if ($values['autocomplete']['autocomplete_mode_hide_directions']) {
          $autocomplete[$autocomplete_mode]['hideDirectionsText'] = $values['autocomplete']['autocomplete_mode_hide_directions'];
        }
      }
    }
    $this->configuration['autocomplete'] = $autocomplete;
  }

}

Members

Namesort descending Modifiers Type Description Overrides
BlockPluginInterface::BLOCK_LABEL_VISIBLE constant Indicates the block label (title) should be displayed to end users.
BlockPluginTrait::$transliteration protected property The transliteration service.
BlockPluginTrait::access public function
BlockPluginTrait::baseConfigurationDefaults protected function Returns generic default configuration for block plugins.
BlockPluginTrait::blockAccess protected function Indicates whether the block should be shown. 16
BlockPluginTrait::buildConfigurationForm public function Creates a generic configuration form for all block types. Individual block plugins can add elements to this form by overriding BlockBase::blockForm(). Most block plugins should not override this method unless they need to alter the generic form elements. 2
BlockPluginTrait::calculateDependencies public function
BlockPluginTrait::defaultConfiguration public function 19
BlockPluginTrait::getConfiguration public function 1
BlockPluginTrait::getMachineNameSuggestion public function 1
BlockPluginTrait::getPreviewFallbackString public function 3
BlockPluginTrait::label public function
BlockPluginTrait::setConfiguration public function
BlockPluginTrait::setConfigurationValue public function
BlockPluginTrait::setTransliteration public function Sets the transliteration service.
BlockPluginTrait::submitConfigurationForm public function Most block plugins should not override this method. To add submission handling for a specific block type, override BlockBase::blockSubmit().
BlockPluginTrait::transliteration protected function Wraps the transliteration service.
BlockPluginTrait::validateConfigurationForm public function Most block plugins should not override this method. To add validation for a specific block type, override BlockBase::blockValidate(). 1
BlockPluginTrait::__construct public function 22
ContextAwarePluginAssignmentTrait::addContextAssignmentElement protected function Builds a form element for assigning a context to a given slot.
ContextAwarePluginAssignmentTrait::contextHandler protected function Wraps the context handler.
ContextAwarePluginBase::$context protected property The data objects representing the context of this plugin.
ContextAwarePluginBase::$contexts Deprecated private property Data objects representing the contexts passed in the plugin configuration.
ContextAwarePluginBase::createContextFromConfiguration protected function Overrides ContextAwarePluginBase::createContextFromConfiguration
ContextAwarePluginBase::getCacheContexts public function The cache contexts associated with this object. Overrides CacheableDependencyInterface::getCacheContexts 9
ContextAwarePluginBase::getCacheMaxAge public function The maximum age for which this object may be cached. Overrides CacheableDependencyInterface::getCacheMaxAge 7
ContextAwarePluginBase::getCacheTags public function The cache tags associated with this object. Overrides CacheableDependencyInterface::getCacheTags 4
ContextAwarePluginBase::getContext public function This code is identical to the Component in order to pick up a different Context class. Overrides ContextAwarePluginBase::getContext
ContextAwarePluginBase::getContextDefinition public function Overrides ContextAwarePluginBase::getContextDefinition
ContextAwarePluginBase::getContextDefinitions public function Overrides ContextAwarePluginBase::getContextDefinitions
ContextAwarePluginBase::getContextMapping public function Gets a mapping of the expected assignment names to their context names. Overrides ContextAwarePluginInterface::getContextMapping
ContextAwarePluginBase::getContexts public function Gets the defined contexts. Overrides ContextAwarePluginInterface::getContexts
ContextAwarePluginBase::getContextValue public function Gets the value for a defined context. Overrides ContextAwarePluginInterface::getContextValue
ContextAwarePluginBase::getContextValues public function Gets the values for all defined contexts. Overrides ContextAwarePluginInterface::getContextValues
ContextAwarePluginBase::setContext public function Set a context on this plugin. Overrides ContextAwarePluginBase::setContext
ContextAwarePluginBase::setContextMapping public function Sets a mapping of the expected assignment names to their context names. Overrides ContextAwarePluginInterface::setContextMapping
ContextAwarePluginBase::setContextValue public function Sets the value for a defined context. Overrides ContextAwarePluginBase::setContextValue
ContextAwarePluginBase::validateContexts public function Validates the set values for the defined contexts. Overrides ContextAwarePluginInterface::validateContexts
ContextAwarePluginBase::__get public function Implements magic __get() method.
DependencySerializationTrait::$_entityStorages protected property An array of entity type IDs keyed by the property name of their storages.
DependencySerializationTrait::$_serviceIds protected property An array of service IDs keyed by property name used for serialization.
DependencySerializationTrait::__sleep public function 1
DependencySerializationTrait::__wakeup public function 2
FederatedSearchPageFormBlock::blockForm public function Returns the configuration form elements specific to this block plugin. Overrides BlockPluginTrait::blockForm
FederatedSearchPageFormBlock::blockSubmit public function Adds block type-specific submission handling for the block form. Overrides BlockPluginTrait::blockSubmit
FederatedSearchPageFormBlock::blockValidate public function Validates that the provided autocomplete endpoint path is a valid relative or absolute URL. Overrides BlockPluginTrait::blockValidate
FederatedSearchPageFormBlock::build public function Builds and returns the renderable array for this block plugin. Overrides BlockPluginInterface::build
MessengerTrait::$messenger protected property The messenger. 29
MessengerTrait::messenger public function Gets the messenger. 29
MessengerTrait::setMessenger public function Sets the messenger.
PluginBase::$configuration protected property Configuration information passed into the plugin. 1
PluginBase::$pluginDefinition protected property The plugin implementation definition. 1
PluginBase::$pluginId protected property The plugin_id.
PluginBase::DERIVATIVE_SEPARATOR constant A string which is used to separate base plugin IDs from the derivative ID.
PluginBase::getBaseId public function Gets the base_plugin_id of the plugin instance. Overrides DerivativeInspectionInterface::getBaseId
PluginBase::getDerivativeId public function Gets the derivative_id of the plugin instance. Overrides DerivativeInspectionInterface::getDerivativeId
PluginBase::getPluginDefinition public function Gets the definition of the plugin implementation. Overrides PluginInspectionInterface::getPluginDefinition 3
PluginBase::getPluginId public function Gets the plugin_id of the plugin instance. Overrides PluginInspectionInterface::getPluginId
PluginBase::isConfigurable public function Determines if the plugin is configurable.
PluginWithFormsTrait::getFormClass public function
PluginWithFormsTrait::hasFormClass public function
StringTranslationTrait::$stringTranslation protected property The string translation service. 1
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.
TypedDataTrait::$typedDataManager protected property The typed data manager used for creating the data types.
TypedDataTrait::getTypedDataManager public function Gets the typed data manager. 2
TypedDataTrait::setTypedDataManager public function Sets the typed data manager. 2