You are here

class EditTexts in TacJS 8.3

Same name and namespace in other branches
  1. 8.6 src/Form/Steps/EditTexts.php \Drupal\tacjs\Form\Steps\EditTexts
  2. 8.2 src/Form/Steps/EditTexts.php \Drupal\tacjs\Form\Steps\EditTexts
  3. 8.4 src/Form/Steps/EditTexts.php \Drupal\tacjs\Form\Steps\EditTexts
  4. 8.5 src/Form/Steps/EditTexts.php \Drupal\tacjs\Form\Steps\EditTexts

Class EditTexts.

@package Drupal\tacjs\Form

Hierarchy

Expanded class hierarchy of EditTexts

1 string reference to 'EditTexts'
tacjs.routing.yml in ./tacjs.routing.yml
tacjs.routing.yml

File

src/Form/Steps/EditTexts.php, line 13

Namespace

Drupal\tacjs\Form\Steps
View source
class EditTexts extends ConfigFormBase {

  /**
   * {@inheritdoc}
   */
  public function getFormId() {
    return 'tacjs_edit_texts';
  }

  /**
   * {@inheritdoc}
   */
  protected function getEditableConfigNames() {
    return [
      'tacjs.settings',
    ];
  }

  /**
   * {@inheritdoc}
   */
  public function buildForm(array $form, FormStateInterface $form_state) {
    $config = $this
      ->config('tacjs.settings');
    $form['middleBarHead'] = [
      '#type' => 'textarea',
      '#title' => $this
        ->t('Middle Bar Head'),
      '#default_value' => $config
        ->get('texts.middleBarHead'),
    ];
    $form['adblock'] = [
      '#type' => 'textarea',
      '#title' => $this
        ->t('Adblock'),
      '#default_value' => $config
        ->get('texts.adblock'),
    ];
    $form['adblock_call'] = [
      '#type' => 'textarea',
      '#title' => $this
        ->t('Adblock Call'),
      '#default_value' => $config
        ->get('texts.adblock_call'),
    ];
    $form['reload'] = [
      '#type' => 'textarea',
      '#title' => $this
        ->t('Reload'),
      '#default_value' => $config
        ->get('texts.reload'),
    ];
    $form['alertBigScroll'] = [
      '#type' => 'textarea',
      '#title' => $this
        ->t('Alert Big Scroll'),
      '#default_value' => $config
        ->get('texts.alertBigScroll'),
    ];
    $form['alertBigClick'] = [
      '#type' => 'textarea',
      '#title' => $this
        ->t('Alert Big Click'),
      '#default_value' => $config
        ->get('texts.alertBigClick'),
    ];
    $form['alertBig'] = [
      '#type' => 'textarea',
      '#title' => $this
        ->t('AlertBig'),
      '#default_value' => $config
        ->get('texts.alertBig'),
    ];
    $form['alertBigPrivacy'] = [
      '#type' => 'textarea',
      '#title' => $this
        ->t('Alert Big Privacy'),
      '#default_value' => $config
        ->get('texts.alertBigPrivacy'),
    ];
    $form['alertSmall'] = [
      '#type' => 'textarea',
      '#title' => $this
        ->t('Alert Small'),
      '#default_value' => $config
        ->get('texts.alertSmall'),
    ];
    $form['personalize'] = [
      '#type' => 'textarea',
      '#title' => $this
        ->t('Personalize'),
      '#default_value' => $config
        ->get('texts.personalize'),
    ];
    $form['acceptAll'] = [
      '#type' => 'textarea',
      '#title' => $this
        ->t('Accept All'),
      '#default_value' => $config
        ->get('texts.acceptAll'),
    ];
    $form['close'] = [
      '#type' => 'textarea',
      '#title' => $this
        ->t('Close'),
      '#default_value' => $config
        ->get('texts.close'),
    ];
    $form['privacyUrl'] = [
      '#type' => 'textarea',
      '#title' => $this
        ->t('Privacy Url'),
      '#default_value' => $config
        ->get('texts.privacyUrl'),
    ];
    $form['all'] = [
      '#type' => 'textarea',
      '#title' => $this
        ->t('All'),
      '#default_value' => $config
        ->get('texts.all'),
    ];
    $form['info'] = [
      '#type' => 'textarea',
      '#title' => $this
        ->t('Info'),
      '#default_value' => $config
        ->get('texts.info'),
    ];
    $form['disclaimer'] = [
      '#type' => 'textarea',
      '#title' => $this
        ->t('Disclaimer'),
      '#default_value' => $config
        ->get('texts.disclaimer'),
    ];
    $form['allow'] = [
      '#type' => 'textarea',
      '#title' => $this
        ->t('Allow'),
      '#default_value' => $config
        ->get('texts.allow'),
    ];
    $form['deny'] = [
      '#type' => 'textarea',
      '#title' => $this
        ->t('Deny'),
      '#default_value' => $config
        ->get('texts.deny'),
    ];
    $form['noCookie'] = [
      '#type' => 'textarea',
      '#title' => $this
        ->t('No Cookie'),
      '#default_value' => $config
        ->get('texts.noCookie'),
    ];
    $form['useCookie'] = [
      '#type' => 'textarea',
      '#title' => $this
        ->t('Use Cookie'),
      '#default_value' => $config
        ->get('texts.useCookie'),
    ];
    $form['useCookieCurrent'] = [
      '#type' => 'textarea',
      '#title' => $this
        ->t('Use Cookie Current'),
      '#default_value' => $config
        ->get('texts.useCookieCurrent'),
    ];
    $form['useNoCookie'] = [
      '#type' => 'textarea',
      '#title' => $this
        ->t('Use No Cookie'),
      '#default_value' => $config
        ->get('texts.useNoCookie'),
    ];
    $form['more'] = [
      '#type' => 'textarea',
      '#title' => $this
        ->t('More'),
      '#default_value' => $config
        ->get('texts.more'),
    ];
    $form['source'] = [
      '#type' => 'textarea',
      '#title' => $this
        ->t('Source'),
      '#default_value' => $config
        ->get('texts.source'),
    ];
    $form['credit'] = [
      '#type' => 'textarea',
      '#title' => $this
        ->t('Credit'),
      '#default_value' => $config
        ->get('texts.credit'),
    ];
    $form['noServices'] = [
      '#type' => 'textarea',
      '#title' => $this
        ->t('No Services'),
      '#default_value' => $config
        ->get('texts.noServices'),
    ];
    $form['toggleInfoBox'] = [
      '#type' => 'textarea',
      '#title' => $this
        ->t('Toggle Info Box'),
      '#default_value' => $config
        ->get('texts.toggleInfoBox'),
    ];
    $form['title'] = [
      '#type' => 'textarea',
      '#title' => $this
        ->t('Title'),
      '#default_value' => $config
        ->get('texts.title'),
    ];
    $form['cookieDetail'] = [
      '#type' => 'textarea',
      '#title' => $this
        ->t('Cookie Detail'),
      '#default_value' => $config
        ->get('texts.cookieDetail'),
    ];
    $form['ourSite'] = [
      '#type' => 'textarea',
      '#title' => $this
        ->t('Our Site'),
      '#default_value' => $config
        ->get('texts.ourSite'),
    ];
    $form['newWindow'] = [
      '#type' => 'textarea',
      '#title' => $this
        ->t('New Window'),
      '#default_value' => $config
        ->get('texts.newWindow'),
    ];
    $form['allowAll'] = [
      '#type' => 'textarea',
      '#title' => $this
        ->t('Allow All'),
      '#default_value' => $config
        ->get('texts.allowAll'),
    ];
    $form['denyAll'] = [
      '#type' => 'textarea',
      '#title' => $this
        ->t('Deny All'),
      '#default_value' => $config
        ->get('texts.denyAll'),
    ];
    $form['fallback'] = [
      '#type' => 'textarea',
      '#title' => $this
        ->t('Fallback'),
      '#default_value' => $config
        ->get('texts.fallback'),
    ];
    $form['ads_title'] = [
      '#type' => 'textarea',
      '#title' => $this
        ->t('Ads Title'),
      '#default_value' => $config
        ->get('texts.ads.title'),
    ];
    $form['ads_details'] = [
      '#type' => 'textarea',
      '#title' => $this
        ->t('Ads Details'),
      '#default_value' => $config
        ->get('texts.ads.details'),
    ];
    $form['analytic_title'] = [
      '#type' => 'textarea',
      '#title' => $this
        ->t('Analytic Title'),
      '#default_value' => $config
        ->get('texts.analytic.title'),
    ];
    $form['analytic_details'] = [
      '#type' => 'textarea',
      '#title' => $this
        ->t('Analytic Details'),
      '#default_value' => $config
        ->get('texts.analytic.details'),
    ];
    $form['social_title'] = [
      '#type' => 'textarea',
      '#title' => $this
        ->t('Social Title'),
      '#default_value' => $config
        ->get('texts.social.title'),
    ];
    $form['social_details'] = [
      '#type' => 'textarea',
      '#title' => $this
        ->t('Social Details'),
      '#default_value' => $config
        ->get('texts.social.details'),
    ];
    $form['video_title'] = [
      '#type' => 'textarea',
      '#title' => $this
        ->t('Video Title'),
      '#default_value' => $config
        ->get('texts.video.title'),
    ];
    $form['video_details'] = [
      '#type' => 'textarea',
      '#title' => $this
        ->t('Video Details'),
      '#default_value' => $config
        ->get('texts.video.details'),
    ];
    $form['comment_title'] = [
      '#type' => 'textarea',
      '#title' => $this
        ->t('Comment Title'),
      '#default_value' => $config
        ->get('texts.comment.title'),
    ];
    $form['comment_details'] = [
      '#type' => 'textarea',
      '#title' => $this
        ->t('Comment Details'),
      '#default_value' => $config
        ->get('texts.comment.details'),
    ];
    $form['support_title'] = [
      '#type' => 'textarea',
      '#title' => $this
        ->t('Support Title'),
      '#default_value' => $config
        ->get('texts.support.title'),
    ];
    $form['support_details'] = [
      '#type' => 'textarea',
      '#title' => $this
        ->t('Support Details'),
      '#default_value' => $config
        ->get('texts.support.details'),
    ];
    $form['api_title'] = [
      '#type' => 'textarea',
      '#title' => $this
        ->t('Api Title'),
      '#default_value' => $config
        ->get('texts.api.title'),
    ];
    $form['api_details'] = [
      '#type' => 'textarea',
      '#title' => $this
        ->t('Api Details'),
      '#default_value' => $config
        ->get('texts.api.details'),
    ];
    $form['other_title'] = [
      '#type' => 'textarea',
      '#title' => $this
        ->t('Other Title'),
      '#default_value' => $config
        ->get('texts.other.title'),
    ];
    $form['other_details'] = [
      '#type' => 'textarea',
      '#title' => $this
        ->t('Other Details'),
      '#default_value' => $config
        ->get('texts.other.details'),
    ];
    return parent::buildForm($form, $form_state);
  }

  /**
   * {@inheritdoc}
   */
  public function submitForm(array &$form, FormStateInterface $form_state) {
    $config = $this
      ->config('tacjs.settings');
    $config
      ->set('texts.middleBarHead', $form_state
      ->getValue('middleBarHead'))
      ->set('texts.adblock', $form_state
      ->getValue('adblock'))
      ->set('texts.adblock_call', $form_state
      ->getValue('adblock_call'))
      ->set('texts.reload', $form_state
      ->getValue('reload'))
      ->set('texts.alertBigScroll', $form_state
      ->getValue('alertBigScroll'))
      ->set('texts.alertBigClick', $form_state
      ->getValue('alertBigClick'))
      ->set('texts.alertBig', $form_state
      ->getValue('alertBig'))
      ->set('texts.alertBigPrivacy', $form_state
      ->getValue('alertBigPrivacy'))
      ->set('texts.alertSmall', $form_state
      ->getValue('alertSmall'))
      ->set('texts.personalize', $form_state
      ->getValue('personalize'))
      ->set('texts.acceptAll', $form_state
      ->getValue('acceptAll'))
      ->set('texts.close', $form_state
      ->getValue('close'))
      ->set('texts.privacyUrl', $form_state
      ->getValue('privacyUrl'))
      ->set('texts.all', $form_state
      ->getValue('all'))
      ->set('texts.info', $form_state
      ->getValue('info'))
      ->set('texts.disclaimer', $form_state
      ->getValue('disclaimer'))
      ->set('texts.allow', $form_state
      ->getValue('allow'))
      ->set('texts.deny', $form_state
      ->getValue('deny'))
      ->set('texts.noCookie', $form_state
      ->getValue('noCookie'))
      ->set('texts.useCookie', $form_state
      ->getValue('useCookie'))
      ->set('texts.useCookieCurrent', $form_state
      ->getValue('useCookieCurrent'))
      ->set('texts.useNoCookie', $form_state
      ->getValue('useNoCookie'))
      ->set('texts.more', $form_state
      ->getValue('more'))
      ->set('texts.source', $form_state
      ->getValue('source'))
      ->set('texts.credit', $form_state
      ->getValue('credit'))
      ->set('texts.noServices', $form_state
      ->getValue('noServices'))
      ->set('texts.toggleInfoBox', $form_state
      ->getValue('toggleInfoBox'))
      ->set('texts.title', $form_state
      ->getValue('title'))
      ->set('texts.cookieDetail', $form_state
      ->getValue('cookieDetail'))
      ->set('texts.ourSite', $form_state
      ->getValue('ourSite'))
      ->set('texts.newWindow', $form_state
      ->getValue('newWindow'))
      ->set('texts.allowAll', $form_state
      ->getValue('allowAll'))
      ->set('texts.denyAll', $form_state
      ->getValue('denyAll'))
      ->set('texts.fallback', $form_state
      ->getValue('fallback'))
      ->set('texts.ads.title', $form_state
      ->getValue('ads_title'))
      ->set('texts.ads.details', $form_state
      ->getValue('ads_details'))
      ->set('texts.analytic.title', $form_state
      ->getValue('analytic_title'))
      ->set('texts.analytic.details', $form_state
      ->getValue('analytic_details'))
      ->set('texts.social.title', $form_state
      ->getValue('social_title'))
      ->set('texts.social.details', $form_state
      ->getValue('social_details'))
      ->set('texts.video.title', $form_state
      ->getValue('video_title'))
      ->set('texts.video.details', $form_state
      ->getValue('video_details'))
      ->set('texts.comment.title', $form_state
      ->getValue('comment_title'))
      ->set('texts.comment.details', $form_state
      ->getValue('comment_details'))
      ->set('texts.support.title', $form_state
      ->getValue('support_title'))
      ->set('texts.support.details', $form_state
      ->getValue('support_details'))
      ->set('texts.api.title', $form_state
      ->getValue('api_title'))
      ->set('texts.api.details', $form_state
      ->getValue('api_details'))
      ->set('texts.other.title', $form_state
      ->getValue('other_title'))
      ->set('texts.other.details', $form_state
      ->getValue('other_details'))
      ->save();
    parent::submitForm($form, $form_state);
  }

}

Members

Namesort descending Modifiers Type Description Overrides
ConfigFormBase::create public static function Instantiates a new instance of this class. Overrides FormBase::create 13
ConfigFormBase::__construct public function Constructs a \Drupal\system\ConfigFormBase object. 11
ConfigFormBaseTrait::config protected function Retrieves a configuration object.
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
EditTexts::buildForm public function Form constructor. Overrides ConfigFormBase::buildForm
EditTexts::getEditableConfigNames protected function Gets the configuration names that will be editable. Overrides ConfigFormBaseTrait::getEditableConfigNames
EditTexts::getFormId public function Returns a unique string identifying the form. Overrides FormInterface::getFormId
EditTexts::submitForm public function Form submission handler. Overrides ConfigFormBase::submitForm
FormBase::$configFactory protected property The config factory. 1
FormBase::$requestStack protected property The request stack. 1
FormBase::$routeMatch protected property The route match.
FormBase::configFactory protected function Gets the config factory for this form. 1
FormBase::container private function Returns the service container.
FormBase::currentUser protected function Gets the current user.
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. Overrides UrlGeneratorTrait::redirect
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 62
LinkGeneratorTrait::$linkGenerator protected property The link generator. 1
LinkGeneratorTrait::getLinkGenerator Deprecated protected function Returns the link generator.
LinkGeneratorTrait::l Deprecated protected function Renders a link to a route given a route name and its parameters.
LinkGeneratorTrait::setLinkGenerator Deprecated public function Sets the link generator service.
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. 29
MessengerTrait::messenger public function Gets the messenger. 29
MessengerTrait::setMessenger public function Sets the messenger.
RedirectDestinationTrait::$redirectDestination protected property The redirect destination service. 1
RedirectDestinationTrait::getDestinationArray protected function Prepares a 'destination' 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. 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.
UrlGeneratorTrait::$urlGenerator protected property The url generator.
UrlGeneratorTrait::getUrlGenerator Deprecated protected function Returns the URL generator service.
UrlGeneratorTrait::setUrlGenerator Deprecated public function Sets the URL generator service.
UrlGeneratorTrait::url Deprecated protected function Generates a URL or path for a specific route based on the given parameters.