set_value($value); } /** * Check if the type is a text. * * @since 0.8 * @return bool */ public function is_text() { return $this->value === self::TEXT; } /** * Check if the type is a number. * * @since 0.8 * @return bool */ public function is_number() { return $this->value === self::NUMBER; } /** * Check if the type is boolean. * * @since 0.8 * @return bool */ public function is_boolean() { return $this->value === self::BOOLEAN; } /** * Check if the type is a file. * * @since 0.8 * @return bool */ public function is_file() { return $this->value === self::FILE; } /** * Get the translated label for the type. * * @since 0.8 * @return null|string The translated label if any. */ public function get_label() { switch($this->value) { case self::TEXT: $label = __('Text', 'affilicious'); break; case self::NUMBER: $label = __('Number', 'affilicious'); break; case self::BOOLEAN: $label = __('Boolean', 'affilicious'); break; case self::FILE: $label = __('File', 'affilicious'); break; default: $label = null; } $label = apply_filters('aff_detail_type_label', $label, $this->value); return $label; } }