first()['value'] ?? null;
}),
Setting::classAttribute(),
Setting::description(),
];
}
public function sanitizeValue($value, array $field)
{
if (!Collection::make($field['table_list'])->pluck('value')->contains($value)) {
return;
}
return $value;
}
/**
* The stored value, when it is one of the choices.
*/
public function displayValue($value, array $field, array $args): string
{
return Display::choice($value, $field);
}
public function render(array $field, $value): void
{
printf(
'',
esc_attr($field['field_name']),
esc_attr($field['field_name'])
);
Collection::make($field['table_list'])->map(function ($row) use ($value) {
vprintf('', [
$value === $row['value'] ? 'selected="selected"' : '',
esc_attr($row['value']),
esc_html(Display::choiceLabel($row))
]);
});
print('');
print(wp_kses_post($this->descriptionHtml($field['description'] ?? '')));
}
}