set_fields();
}
/**
* Initializes the integration.
*
* This is the place to register hooks and filters.
*
* @return void
*/
public function register_hooks() {
\add_action( 'show_user_profile', [ $this, 'user_profile' ], 5 );
\add_action( 'edit_user_profile', [ $this, 'user_profile' ], 5 );
\add_action( 'personal_options_update', [ $this, 'process_user_option_update' ] );
\add_action( 'edit_user_profile_update', [ $this, 'process_user_option_update' ] );
}
/**
* Returns the conditionals based in which this loadable should be active.
*
* @return array
*/
public static function get_conditionals() {
return [ Admin_Conditional::class ];
}
/**
* Sets the fields and their labels and descriptions.
*/
private function set_fields() {
$this->fields = [
'basicInfo' => [
'label' => \__( 'Basic information', 'wordpress-seo-premium' ),
'type' => 'group',
],
'honorificPrefix' => [
'label' => \__( 'Honorific prefix', 'wordpress-seo-premium' ),
/* translators: %1$s is replaced by ``, %2$s by ``. */
'description' => \sprintf( \esc_html__( 'E.g. %1$sDr%2$s, %1$sMs%2$s, %1$sMr%2$s', 'wordpress-seo-premium' ), '', '' ),
'type' => 'string',
],
'honorificSuffix' => [
'label' => \__( 'Honorific suffix', 'wordpress-seo-premium' ),
/* translators: %1$s is replaced by ``, %2$s by ``. */
'description' => \sprintf( \esc_html__( 'E.g. %1$sMD%2$s, %1$sPhD%2$s', 'wordpress-seo-premium' ), '', '' ),
'type' => 'string',
],
'birthDate' => [
'label' => \__( 'Birth date', 'wordpress-seo-premium' ),
/* translators: %1$s is replaced by ``, %2$s by ``. */
'description' => \sprintf( \esc_html__( 'Use format: %1$sYYYY-MM-DD%2$s', 'wordpress-seo-premium' ), '', '' ),
'type' => 'date',
],
'gender' => [
'label' => \__( 'Gender', 'wordpress-seo-premium' ),
/* translators: %1$s is replaced by ``, %2$s by ``. */
'description' => \sprintf( \esc_html__( 'E.g. %1$sfemale%2$s, %1$smale%2$s, %1$snon-binary%2$s', 'wordpress-seo-premium' ), '', '' ),
'type' => 'string',
],
'extraInfo' => [
'label' => \__( 'Extra information', 'wordpress-seo-premium' ),
'type' => 'group',
],
'award' => [
'label' => \__( 'Awards', 'wordpress-seo-premium' ),
/* translators: %1$s is replaced by ``, %2$s by ``. */
'description' => \sprintf( \esc_html__( 'Comma separated, e.g. %1$sMost likely to succeed - 1991, Smartest in class - 1990%2$s', 'wordpress-seo-premium' ), '', '' ),
'type' => 'array',
],
'knowsAbout' => [
'label' => \__( 'Expertise in', 'wordpress-seo-premium' ),
/* translators: %1$s is replaced by ``, %2$s by ``. */
'description' => \sprintf( \esc_html__( 'Comma separated, e.g. %1$sPHP, JavaScript, 90\'s rock music%2$s', 'wordpress-seo-premium' ), '', '' ),
'type' => 'array',
],
'knowsLanguage' => [
'label' => \__( 'Language(s) spoken', 'wordpress-seo-premium' ),
/* translators: %1$s is replaced by ``, %2$s by ``. */
'description' => \sprintf( \esc_html__( 'Comma separated, e.g. %1$sEnglish, French, Dutch%2$s', 'wordpress-seo-premium' ), '', '' ),
'type' => 'array',
],
'jobInfo' => [
'label' => \__( 'Employer information', 'wordpress-seo-premium' ),
'type' => 'group',
],
'jobTitle' => [
'label' => \__( 'Job title', 'wordpress-seo-premium' ),
/* translators: %1$s is replaced by ``, %2$s by ``. */
'description' => \sprintf( \esc_html__( 'E.g. %1$ssoftware engineer%2$s', 'wordpress-seo-premium' ), '', '' ),
'type' => 'string',
],
'worksFor' => [
'label' => \__( 'Employer name', 'wordpress-seo-premium' ),
/* translators: %1$s is replaced by ``, %2$s by ``. */
'description' => \sprintf( \esc_html__( 'E.g. %1$sAcme inc%2$s', 'wordpress-seo-premium' ), '', '' ),
'type' => 'string',
],
];
}
/**
* Shows a form to add Schema fields to a user.
*
* @param WP_User $user The current page's user.
*
* @return void
*/
public function user_profile( $user ) {
\wp_nonce_field( self::NONCE_FIELD_ACTION, self::NONCE_FIELD_NAME );
echo '
', \esc_html__( 'The info you add below is added to the data Yoast SEO outputs in its schema.org output, for instance when you\'re the author of a page. Please only add the info you feel good sharing publicly.', 'wordpress-seo-premium' ), '
'; $user_schema = \get_user_meta( $user->ID, 'wpseo_user_schema', true ); echo '', $field['description'], '
'; } echo '