class EditTexts in TacJS 8.6
Same name and namespace in other branches
- 8.2 src/Form/Steps/EditTexts.php \Drupal\tacjs\Form\Steps\EditTexts
- 8.3 src/Form/Steps/EditTexts.php \Drupal\tacjs\Form\Steps\EditTexts
- 8.4 src/Form/Steps/EditTexts.php \Drupal\tacjs\Form\Steps\EditTexts
- 8.5 src/Form/Steps/EditTexts.php \Drupal\tacjs\Form\Steps\EditTexts
Class EditTexts.
@package Drupal\tacjs\Form
Hierarchy
- class \Drupal\Core\Form\FormBase implements ContainerInjectionInterface, FormInterface uses DependencySerializationTrait, LoggerChannelTrait, MessengerTrait, LinkGeneratorTrait, RedirectDestinationTrait, UrlGeneratorTrait, StringTranslationTrait
- class \Drupal\Core\Form\ConfigFormBase uses ConfigFormBaseTrait
- class \Drupal\tacjs\Form\Steps\EditTexts
- class \Drupal\Core\Form\ConfigFormBase uses ConfigFormBaseTrait
Expanded class hierarchy of EditTexts
1 string reference to 'EditTexts'
File
- src/
Form/ Steps/ EditTexts.php, line 13
Namespace
Drupal\tacjs\Form\StepsView 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'),
'#placeholder' => $this
->t('☝ 🍪'),
];
$form['adblock'] = [
'#type' => 'textarea',
'#title' => $this
->t('Adblock'),
'#default_value' => $config
->get('texts.adblock'),
'#placeholder' => $this
->t('Hello! This site is transparent and lets you choose the 3rd party services you want to allow.'),
];
$form['adblock_call'] = [
'#type' => 'textarea',
'#title' => $this
->t('Adblock Call'),
'#default_value' => $config
->get('texts.adblock_call'),
'#placeholder' => $this
->t('Please disable your adblocker to start customizing.'),
];
$form['reload'] = [
'#type' => 'textarea',
'#title' => $this
->t('Reload'),
'#default_value' => $config
->get('texts.reload'),
'#placeholder' => $this
->t('Refresh the page'),
];
$form['alertBigScroll'] = [
'#type' => 'textarea',
'#title' => $this
->t('Alert Big Scroll'),
'#default_value' => $config
->get('texts.alertBigScroll'),
'#placeholder' => $this
->t('By continuing to scroll,'),
];
$form['alertBigClick'] = [
'#type' => 'textarea',
'#title' => $this
->t('Alert Big Click'),
'#default_value' => $config
->get('texts.alertBigClick'),
'#placeholder' => $this
->t('If you continue to browse this website,'),
];
$form['alertBig'] = [
'#type' => 'textarea',
'#title' => $this
->t('AlertBig'),
'#default_value' => $config
->get('texts.alertBig'),
'#placeholder' => $this
->t('you are allowing all third-party services'),
];
$form['alertBigPrivacy'] = [
'#type' => 'textarea',
'#title' => $this
->t('Alert Big Privacy'),
'#default_value' => $config
->get('texts.alertBigPrivacy'),
'#placeholder' => $this
->t('This site uses cookies and gives you control over what you want to activate'),
];
$form['alertSmall'] = [
'#type' => 'textarea',
'#title' => $this
->t('Alert Small'),
'#default_value' => $config
->get('texts.alertSmall'),
'#placeholder' => $this
->t('Manage services'),
];
$form['personalize'] = [
'#type' => 'textarea',
'#title' => $this
->t('Personalize'),
'#default_value' => $config
->get('texts.personalize'),
'#placeholder' => $this
->t('Personalize'),
];
$form['acceptAll'] = [
'#type' => 'textarea',
'#title' => $this
->t('Accept All'),
'#default_value' => $config
->get('texts.acceptAll'),
'#placeholder' => $this
->t('OK, accept all'),
];
$form['close'] = [
'#type' => 'textarea',
'#title' => $this
->t('Close'),
'#default_value' => $config
->get('texts.close'),
'#placeholder' => $this
->t('Close'),
];
$form['privacyUrl'] = [
'#type' => 'textarea',
'#title' => $this
->t('Privacy Url'),
'#default_value' => $config
->get('texts.privacyUrl'),
'#placeholder' => $this
->t('Privacy policy'),
];
$form['all'] = [
'#type' => 'textarea',
'#title' => $this
->t('All'),
'#default_value' => $config
->get('texts.all'),
'#placeholder' => $this
->t('Preference for all services'),
];
$form['info'] = [
'#type' => 'textarea',
'#title' => $this
->t('Info'),
'#default_value' => $config
->get('texts.info'),
'#placeholder' => $this
->t('Protecting your privacy'),
];
$form['disclaimer'] = [
'#type' => 'textarea',
'#title' => $this
->t('Disclaimer'),
'#default_value' => $config
->get('texts.disclaimer'),
'#placeholder' => $this
->t('By allowing these third party services, you accept their cookies and the use of tracking technologies necessary for their proper functioning.'),
];
$form['allow'] = [
'#type' => 'textarea',
'#title' => $this
->t('Allow'),
'#default_value' => $config
->get('texts.allow'),
'#placeholder' => $this
->t('Allow'),
];
$form['deny'] = [
'#type' => 'textarea',
'#title' => $this
->t('Deny'),
'#default_value' => $config
->get('texts.deny'),
'#placeholder' => $this
->t('Deny'),
];
$form['noCookie'] = [
'#type' => 'textarea',
'#title' => $this
->t('No Cookie'),
'#default_value' => $config
->get('texts.noCookie'),
'#placeholder' => $this
->t('This service does not use cookie.'),
];
$form['useCookie'] = [
'#type' => 'textarea',
'#title' => $this
->t('Use Cookie'),
'#default_value' => $config
->get('texts.useCookie'),
'#placeholder' => $this
->t('This service can install'),
];
$form['useCookieCurrent'] = [
'#type' => 'textarea',
'#title' => $this
->t('Use Cookie Current'),
'#default_value' => $config
->get('texts.useCookieCurrent'),
'#placeholder' => $this
->t('This service has installed'),
];
$form['useNoCookie'] = [
'#type' => 'textarea',
'#title' => $this
->t('Use No Cookie'),
'#default_value' => $config
->get('texts.useNoCookie'),
'#placeholder' => $this
->t('This service has not installed any cookie.'),
];
$form['more'] = [
'#type' => 'textarea',
'#title' => $this
->t('More'),
'#default_value' => $config
->get('texts.more'),
'#placeholder' => $this
->t('Read more'),
];
$form['source'] = [
'#type' => 'textarea',
'#title' => $this
->t('Source'),
'#default_value' => $config
->get('texts.source'),
'#placeholder' => $this
->t('View the official website'),
];
$form['credit'] = [
'#type' => 'textarea',
'#title' => $this
->t('Credit'),
'#default_value' => $config
->get('texts.credit'),
'#placeholder' => $this
->t('Cookies manager by tarteaucitron.js'),
];
$form['noServices'] = [
'#type' => 'textarea',
'#title' => $this
->t('No Services'),
'#default_value' => $config
->get('texts.noServices'),
'#placeholder' => $this
->t('This website does not use any cookie requiring your consent.'),
];
$form['toggleInfoBox'] = [
'#type' => 'textarea',
'#title' => $this
->t('Toggle Info Box'),
'#default_value' => $config
->get('texts.toggleInfoBox'),
'#placeholder' => $this
->t('Show/hide informations about cookie storage'),
];
$form['title'] = [
'#type' => 'textarea',
'#title' => $this
->t('Title'),
'#default_value' => $config
->get('texts.title'),
'#placeholder' => $this
->t('Cookies management panel'),
];
$form['cookieDetail'] = [
'#type' => 'textarea',
'#title' => $this
->t('Cookie Detail'),
'#default_value' => $config
->get('texts.cookieDetail'),
'#placeholder' => $this
->t('Cookie detail for'),
];
$form['ourSite'] = [
'#type' => 'textarea',
'#title' => $this
->t('Our Site'),
'#default_value' => $config
->get('texts.ourSite'),
'#placeholder' => $this
->t('on our site'),
];
$form['newWindow'] = [
'#type' => 'textarea',
'#title' => $this
->t('New Window'),
'#default_value' => $config
->get('texts.newWindow'),
'#placeholder' => $this
->t('(new window)'),
];
$form['allowAll'] = [
'#type' => 'textarea',
'#title' => $this
->t('Allow All'),
'#default_value' => $config
->get('texts.allowAll'),
'#placeholder' => $this
->t('Allow all cookies'),
];
$form['denyAll'] = [
'#type' => 'textarea',
'#title' => $this
->t('Deny All'),
'#default_value' => $config
->get('texts.denyAll'),
'#placeholder' => $this
->t('Deny all cookies'),
];
$form['fallback'] = [
'#type' => 'textarea',
'#title' => $this
->t('Fallback'),
'#default_value' => $config
->get('texts.fallback'),
'#placeholder' => $this
->t('is disabled.'),
];
$form['ads_title'] = [
'#type' => 'textarea',
'#title' => $this
->t('Ads Title'),
'#default_value' => $config
->get('texts.ads.title'),
'#placeholder' => $this
->t('Advertising network'),
];
$form['ads_details'] = [
'#type' => 'textarea',
'#title' => $this
->t('Ads Details'),
'#default_value' => $config
->get('texts.ads.details'),
'#placeholder' => $this
->t('Ad networks can generate revenue by selling advertising space on the site.'),
];
$form['analytic_title'] = [
'#type' => 'textarea',
'#title' => $this
->t('Analytic Title'),
'#default_value' => $config
->get('texts.analytic.title'),
'#placeholder' => $this
->t('Audience measurement'),
];
$form['analytic_details'] = [
'#type' => 'textarea',
'#title' => $this
->t('Analytic Details'),
'#default_value' => $config
->get('texts.analytic.details'),
'#placeholder' => $this
->t('The audience measurement services used to generate useful statistics attendance to improve the site.'),
];
$form['social_title'] = [
'#type' => 'textarea',
'#title' => $this
->t('Social Title'),
'#default_value' => $config
->get('texts.social.title'),
'#placeholder' => $this
->t('Social networks'),
];
$form['social_details'] = [
'#type' => 'textarea',
'#title' => $this
->t('Social Details'),
'#default_value' => $config
->get('texts.social.details'),
'#placeholder' => $this
->t('Social networks can improve the usability of the site and help to promote it via the shares.'),
];
$form['video_title'] = [
'#type' => 'textarea',
'#title' => $this
->t('Video Title'),
'#default_value' => $config
->get('texts.video.title'),
'#placeholder' => $this
->t('Videos'),
];
$form['video_details'] = [
'#type' => 'textarea',
'#title' => $this
->t('Video Details'),
'#default_value' => $config
->get('texts.video.details'),
'#placeholder' => $this
->t('Video sharing services help to add rich media on the site and increase its visibility.'),
];
$form['comment_title'] = [
'#type' => 'textarea',
'#title' => $this
->t('Comment Title'),
'#default_value' => $config
->get('texts.comment.title'),
'#placeholder' => $this
->t('Comments'),
];
$form['comment_details'] = [
'#type' => 'textarea',
'#title' => $this
->t('Comment Details'),
'#default_value' => $config
->get('texts.comment.details'),
'#placeholder' => $this
->t('Comments managers facilitate the filing of comments and fight against spam.'),
];
$form['support_title'] = [
'#type' => 'textarea',
'#title' => $this
->t('Support Title'),
'#default_value' => $config
->get('texts.support.title'),
'#placeholder' => $this
->t('Support'),
];
$form['support_details'] = [
'#type' => 'textarea',
'#title' => $this
->t('Support Details'),
'#default_value' => $config
->get('texts.support.details'),
'#placeholder' => $this
->t('Support services allow you to get in touch with the site team and help to improve it.'),
];
$form['api_title'] = [
'#type' => 'textarea',
'#title' => $this
->t('Api Title'),
'#default_value' => $config
->get('texts.api.title'),
'#placeholder' => $this
->t('APIs'),
];
$form['api_details'] = [
'#type' => 'textarea',
'#title' => $this
->t('Api Details'),
'#default_value' => $config
->get('texts.api.details'),
'#placeholder' => $this
->t('APIs are used to load scripts: geolocation, search engines, translations, ...'),
];
$form['other_title'] = [
'#type' => 'textarea',
'#title' => $this
->t('Other Title'),
'#default_value' => $config
->get('texts.other.title'),
'#placeholder' => $this
->t('Other'),
];
$form['other_details'] = [
'#type' => 'textarea',
'#title' => $this
->t('Other Details'),
'#default_value' => $config
->get('texts.other.details'),
'#placeholder' => $this
->t('Services to display web content.'),
];
$form['mandatoryTitle'] = [
'#type' => 'textarea',
'#title' => $this
->t('Mandatory title'),
'#default_value' => $config
->get('texts.mandatoryTitle'),
'#placeholder' => $this
->t('Mandatory cookies'),
];
$form['mandatoryText'] = [
'#type' => 'textarea',
'#title' => $this
->t('Mandatory text'),
'#default_value' => $config
->get('texts.mandatoryText'),
'#placeholder' => $this
->t('This site uses cookies necessary for its proper functioning which cannot be deactivated.'),
];
return parent::buildForm($form, $form_state);
}
/**
* {@inheritdoc}
*/
public function submitForm(array &$form, FormStateInterface $form_state) {
$config = $this
->config('tacjs.settings');
$elements = [
'middleBarHead' => 'middleBarHead',
'adblock' => 'adblock',
'adblock_call' => 'adblock_call',
'reload' => 'reload',
'alertBigScroll' => 'alertBigScroll',
'alertBigClick' => 'alertBigClick',
'alertBig' => 'alertBig',
'alertBigPrivacy' => 'alertBigPrivacy',
'alertSmall' => 'alertSmall',
'personalize' => 'personalize',
'acceptAll' => 'acceptAll',
'close' => 'close',
'privacyUrl' => 'privacyUrl',
'all' => 'all',
'info' => 'info',
'disclaimer' => 'disclaimer',
'allow' => 'allow',
'deny' => 'deny',
'noCookie' => 'noCookie',
'useCookie' => 'useCookie',
'useCookieCurrent' => 'useCookieCurrent',
'useNoCookie' => 'useNoCookie',
'more' => 'more',
'source' => 'source',
'credit' => 'credit',
'noServices' => 'noServices',
'toggleInfoBox' => 'toggleInfoBox',
'title' => 'title',
'cookieDetail' => 'cookieDetail',
'ourSite' => 'ourSite',
'newWindow' => 'newWindow',
'allowAll' => 'allowAll',
'denyAll' => 'denyAll',
'fallback' => 'fallback',
'ads.title' => 'ads_title',
'ads.details' => 'ads_details',
'analytic.title' => 'analytic_title',
'analytic.details' => 'analytic_details',
'social.title' => 'social_title',
'social.details' => 'social_details',
'video.title' => 'video_title',
'video.details' => 'video_details',
'comment.title' => 'comment_title',
'comment.details' => 'comment_details',
'support.title' => 'support_title',
'support.details' => 'support_details',
'api.title' => 'api_title',
'api.details' => 'api_details',
'other.title' => 'other_title',
'other.details' => 'other_details',
'mandatoryTitle' => 'mandatoryTitle',
'mandatoryText' => 'mandatoryText',
];
foreach ($elements as $key => $element) {
if ($form_state
->getValue($element)) {
$config
->set('texts.' . $key, $form_state
->getValue($element));
}
else {
$config
->clear('texts.' . $key);
}
}
$config
->save();
parent::submitForm($form, $form_state);
}
}
Members
Name![]() |
Modifiers | Type | Description | Overrides |
---|---|---|---|---|
ConfigFormBase:: |
public static | function |
Instantiates a new instance of this class. Overrides FormBase:: |
13 |
ConfigFormBase:: |
public | function | Constructs a \Drupal\system\ConfigFormBase object. | 11 |
ConfigFormBaseTrait:: |
protected | function | Retrieves a configuration object. | |
DependencySerializationTrait:: |
protected | property | An array of entity type IDs keyed by the property name of their storages. | |
DependencySerializationTrait:: |
protected | property | An array of service IDs keyed by property name used for serialization. | |
DependencySerializationTrait:: |
public | function | 1 | |
DependencySerializationTrait:: |
public | function | 2 | |
EditTexts:: |
public | function |
Form constructor. Overrides ConfigFormBase:: |
|
EditTexts:: |
protected | function |
Gets the configuration names that will be editable. Overrides ConfigFormBaseTrait:: |
|
EditTexts:: |
public | function |
Returns a unique string identifying the form. Overrides FormInterface:: |
|
EditTexts:: |
public | function |
Form submission handler. Overrides ConfigFormBase:: |
|
FormBase:: |
protected | property | The config factory. | 1 |
FormBase:: |
protected | property | The request stack. | 1 |
FormBase:: |
protected | property | The route match. | |
FormBase:: |
protected | function | Gets the config factory for this form. | 1 |
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. Overrides UrlGeneratorTrait:: |
|
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:: |
62 |
LinkGeneratorTrait:: |
protected | property | The link generator. | 1 |
LinkGeneratorTrait:: |
protected | function | Returns the link generator. | |
LinkGeneratorTrait:: |
protected | function | Renders a link to a route given a route name and its parameters. | |
LinkGeneratorTrait:: |
public | function | Sets the link generator service. | |
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. | 29 |
MessengerTrait:: |
public | function | Gets the messenger. | 29 |
MessengerTrait:: |
public | function | Sets the messenger. | |
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. | 1 |
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. | |
UrlGeneratorTrait:: |
protected | property | The url generator. | |
UrlGeneratorTrait:: |
protected | function | Returns the URL generator service. | |
UrlGeneratorTrait:: |
public | function | Sets the URL generator service. | |
UrlGeneratorTrait:: |
protected | function | Generates a URL or path for a specific route based on the given parameters. |