cloggier
↑
/wp-content/plugins/wpforms-sendinblue/src/Provider
marsupiataab
hypermuffing
cloggier
hypermuffing
marsupiataab
BaseField.php
2,723 B
cloggier
marsupiataab
DefaultField.php
2,670 B
cloggier
marsupiataab
FieldMapper.php
5,091 B
cloggier
marsupiataab
LikertScaleField.php
1,240 B
cloggier
marsupiataab
NameField.php
848 B
cloggier
marsupiataab
PasswordField.php
895 B
cloggier
marsupiataab
<?php namespace WPFormsSendinblue\Provider\CustomFields; /** * Class LikertScaleField. * * @since 1.0.0 */ class LikertScaleField extends DefaultField { /** * Text format. * * @since 1.0.0 * * @return string */ protected function text() { $value = parent::text(); if ( ! empty( $this->settings['single_row'] ) ) { return $value; } /** * Likert field value by default has a special formatting: * Item #1: * 1 * Note the new line. We need to merge everything in one string, * because Sendinblue does not support textarea, only text fields. */ return str_replace( [ ":\r\n", ":\r", ":\n" ], ': ', $value ); } /** * Category format. * * @since 1.0.0 * * @return int|null */ protected function category() { // Isn't category attribute. if ( empty( $this->attribute['enumeration'] ) ) { return null; } // We can find only for single row. if ( ! $this->settings['single_row'] ) { return null; } // Try to find element by label. foreach ( $this->attribute['enumeration'] as $choice ) { if ( $choice['label'] === $this->field['value'] ) { return $choice['value']; } } // Return id of this choice. return $this->field['value_raw']; } }
cloggier