data = $comment_author; parent::__construct(); } /** * Initializes the object * * @return void */ protected function init() { if ( empty( $this->fields ) ) { $this->fields = [ 'id' => function () { return ! empty( $this->data->comment_ID ) ? Relay::toGlobalId( 'comment_author', $this->data->comment_ID ) : null; }, 'databaseId' => function () { return ! empty( $this->data->comment_ID ) ? absint( $this->data->comment_ID ) : null; }, 'name' => function () { return ! empty( $this->data->comment_author ) ? $this->data->comment_author : null; }, 'email' => function () { return current_user_can( 'moderate_comments' ) && ! empty( $this->data->comment_author_email ) ? $this->data->comment_author_email : null; }, 'url' => function () { return ! empty( $this->data->comment_author_url ) ? $this->data->comment_author_url : ''; }, ]; } } }