CoolCMS API

TranslationInput
in package

FinalYes

Tells whether a language of a multilingual admin form was left blank (fields `<field>_<langId>`).

The form traits create the translation entity of a language the record has no text in yet. Without this check every save added an empty inactive text per such language, so a save without changes changed the database (resave harness). A language with nothing entered keeps no row; as soon as anything is filled in (or the language is ticked active), the row is created as before. An existing translation is always updated, never skipped.

Table of Contents

Methods

isBlank()  : bool
isEmptyValue()  : bool
Null, false, an empty or whitespace string, an empty array and an upload without a file are blank; anything else (0 included) is input.

Methods

isBlank()

public static isBlank(iterable<string|int, mixed>|object $values, int $langId, array<int, string> $fields) : bool
Parameters
$values : iterable<string|int, mixed>|object

submitted values (ArrayHash or array)

$langId : int
$fields : array<int, string>

field names without the _<langId> suffix, the active checkbox included

Return values
bool

isEmptyValue()

Null, false, an empty or whitespace string, an empty array and an upload without a file are blank; anything else (0 included) is input.

private static isEmptyValue(mixed $value) : bool
Parameters
$value : mixed
Return values
bool
On this page

Search results