[PP-2] use the serialization api instead of a custom php method

Created on 19 August 2025, 17 days ago

Problem/Motivation

currently the skipto module is using this custom php method for transforming an array into a json string

  private function skipto_generate_config_json(array $config_export): string {
    $properties = [
      'colorTheme','containerElement', 'displayOption', 'highlightTarget', 'positionLeft', 'fontSize', 'fontFamily', 'headings', 'landmarks', 'aboutVersion', 'dialogBackgroundTitleDarkColor', 'dialogBackgroundTitleColor',
    ];

    $config_array = [];

    foreach ($properties as $property) {
      $config_array[$property] = is_array($config_export[$property]) ? implode(' ', $config_export[$property]) : $config_export[$property];
    }

    return json_encode($config_array);
  }

it works but it would probably the better choice to use a method already available in symfony and or drupal

Steps to reproduce

Proposed resolution

use drupal serialization api. i'll postpone the issue on Make the skipTo module configurable on a per user basis Active for now.

Remaining tasks

User interface changes

API changes

Data model changes

Feature request
Status

Active

Version

2.0

Component

Code

Created by

🇩🇪Germany rkoller Nürnberg, Germany

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Comments & Activities

Production build 0.71.5 2024