ACF_Location::compare_to_rule
Compares the given value and rule params returning true when they match.
Метод класса: ACF_Location{}
Хуков нет.
Возвращает
true|false.
Использование
$ACF_Location = new ACF_Location(); $ACF_Location->compare_to_rule( $value, $rule );
- $value(разное) (обязательный)
- The value to compare against.
- $rule(массив) (обязательный)
- The location rule data.
Список изменений
| С версии 5.8.1 | Введена. |
Код ACF_Location::compare_to_rule() ACF Location::compare to rule ACF 6.4.2
public function compare_to_rule( $value, $rule ) {
$result = ( $value == $rule['value'] );
// Allow "all" to match any value.
if ( $rule['value'] === 'all' ) {
$result = true;
}
// Reverse result for "!=" operator.
if ( $rule['operator'] === '!=' ) {
return ! $result;
}
return $result;
}