foreach ( $field['options'] as $key => $value ) {
echo '<li><label><input
name="' . esc_attr( $field['name'] ) . '"
value="' . esc_attr( $key ) . '"
type="checkbox"
class="' . esc_attr( $field['class'] ) . '"
style="' . esc_attr( $field['style'] ) . '"
' . (array_search($key, is_array($field["value"]) ? $field["value"]:array($field["value"])) !== false ? "checked": '' ). ' /> ' . esc_html( $value ) . '</label>
</li>';
}
array_search($key, is_array($field["value"])? $field["value"]:array($field["value"])) !== false ? "checked":""
echo "<pre>";
var_dump($field["options"]);
echo "</pre>" ;
echo "<pre>" ;
var_dump($field["value"]);
echo "</pre>";
echo in_array( $key, array( $field['value'] ) ) ? 'checked="checked"' : 'not in array';
checked="checked"
написать просто checked
in_array( $key, array( $field['value'] ) )
'links' => [
[
'from' => 'leads',
'from_id' => 15350877,
'to' => 'catalog_elements',
'from_catalog_id' => 2,
'to_catalog_id' => 9571
],
[
'from' => 'leads',
'from_id' => 15350729,
'to' => 'catalog_elements',
'from_catalog_id' => 2,
'to_catalog_id' => 9571
]
]
onSave: function () {
if(какое-то условие){
return false; // Отмена установки
}
return true; // Установка
}