Yoast_Feature_Toggle::__construct
Constructor.
Sets the feature toggle arguments.
Метод класса: Yoast_Feature_Toggle{}
Хуков нет.
Возвращает
null. Ничего (null).
Использование
$Yoast_Feature_Toggle = new Yoast_Feature_Toggle(); $Yoast_Feature_Toggle->__construct( $args );
- $args(массив) (обязательный)
Feature toggle arguments.
-
name(строка)
Required. Feature toggle identifier. -
setting(строка)
Required. Name of the setting the feature toggle is associated with. -
disabled(true|false)
Disable the integration toggle.
По умолчанию: false -
label(строка)
Feature toggle label. -
read_more_url(строка)
URL to learn more about the feature.
По умолчанию: empty string -
premium_upsell_url(строка)
URL to buy premium.
По умолчанию: empty string -
read_more_label(строка)
Label for the learn more link.
По умолчанию: empty string -
extra(строка)
Additional help content for the feature.
По умолчанию: empty string -
order(int)
Value to specify the feature toggle order. A lower value indicates a higher priority.
По умолчанию: 100 -
new(строка)
Whether the feature is new or not. -
in_beta(true|false)
Whether the feature is in beta or not. -
supported_languages(массив)
The languages that this feature supports. - premium_version(строка)
The Premium version in which this feature was added.
-
Код Yoast_Feature_Toggle::__construct() Yoast Feature Toggle:: construct Yoast 27.5
public function __construct( array $args ) {
$required_keys = [ 'name', 'setting' ];
foreach ( $required_keys as $key ) {
if ( empty( $args[ $key ] ) ) {
/* translators: %s: argument name */
throw new InvalidArgumentException( sprintf( __( '%s is a required feature toggle argument.', 'wordpress-seo' ), $key ) );
}
}
foreach ( $args as $key => $value ) {
if ( property_exists( $this, $key ) ) {
$this->$key = $value;
}
}
}