ConditionalFieldsHandlerBase.php in Conditional Fields 8
File
src/ConditionalFieldsHandlerBase.php
View source
<?php
namespace Drupal\conditional_fields;
abstract class ConditionalFieldsHandlerBase implements ConditionalFieldsHandlersPluginInterface {
public function getWidgetValue(array $value_form) {
if (empty($value_form)) {
return null;
}
else {
return $value_form[0]['value'];
}
}
public function getConditionValues(array $options) {
if (isset($options['values'])) {
$value_data = $options['values'];
}
else {
$value_data = $options;
}
if (is_array($value_data)) {
$values = $value_data;
}
elseif (is_string($value_data)) {
$values = preg_split("/[\r\n]+/g", $value_data);
}
else {
$values = [];
}
return $values;
}
}