Translations::add_entry_or_merge()publicWP 2.8.0

Adds or merges an entry to the PO structure.

Метод класса: Translations{}

Хуков нет.

Возвращает

true|false. True on success, false if the entry doesn't have a key.

Использование

$Translations = new Translations();
$Translations->add_entry_or_merge( $entry );
$entry(массив|Translation_Entry) (обязательный)
-

Список изменений

С версии 2.8.0 Введена.

Код Translations::add_entry_or_merge() WP 6.5.5

public function add_entry_or_merge( $entry ) {
	if ( is_array( $entry ) ) {
		$entry = new Translation_Entry( $entry );
	}
	$key = $entry->key();
	if ( false === $key ) {
		return false;
	}
	if ( isset( $this->entries[ $key ] ) ) {
		$this->entries[ $key ]->merge_with( $entry );
	} else {
		$this->entries[ $key ] = &$entry;
	}
	return true;
}