public function displayStructuredData(array $data, array $options = []): string
    {
        $options = Hash::merge([
            'expanded' => true,
            'expandLinkText' => __d('ck_tools', 'utility.toggle_content'),
            'type' => 'array',
        ], $options);

        switch ($options['type']) {
            case 'table':
                $list = $this->arrayToTable($data, $options);
                break;
            case 'array':
            default:
                $list = $this->arrayToUnorderedList($data);
                break;
        }

        if (!$options['expanded']) {
            $id = 'dsd-' . uniqid();
            $out = $this->Html->link($options['expandLinkText'], 'javascript:', [
                'type' => 'button',
                'data-toggle' => 'collapse',
                'aria-expanded' => 'false',
                'aria-controls' => $id,
                'data-target' => '#' . $id,
            ]);
            $out .= '<div class="collapse" id="' . $id . '">' . $list . '</div>';
        } else {
            $out = $list;
        }

        return $out;
    }
public function displayStructuredData(array $data, array $options = []): string
    {
        $options = Hash::merge([
            'expanded' => true,
            'expandLinkText' => __d('ck_tools', 'utility.toggle_content'),
            'type' => 'array',
        ], $options);

        switch ($options['type']) {
            case 'table':
                $list = $this->arrayToTable($data, $options);
                break;
            case 'array':
            default:
                $list = $this->arrayToUnorderedList($data);
                break;
        }

        if (!$options['expanded']) {
            $id = 'dsd-' . uniqid();
            $out = $this->Html->link($options['expandLinkText'], 'javascript:', [
                'type' => 'button',
                'data-toggle' => 'collapse',
                'aria-expanded' => 'false',
                'aria-controls' => $id,
                'data-target' => '#' . $id,
            ]);
            $out .= '<div class="collapse" id="' . $id . '">' . $list . '</div>';
        } else {
            $out = $list;
        }

        return $out;
    }
public function displayStructuredData ( array $ data , array $ options = [ ] ) : string { $ options = Hash :: merge ( [ 'expanded' => true , 'expandLinkText' => __d ( 'ck_tools' , 'utility.toggle_content' ) , 'type' => 'array' , ] , $ options ) ; switch ( $ options [ 'type' ] ) { case 'table' : $ list = $ this -> arrayToTable ( $ data , $ options ) ; break ; case 'array' : default : $ list = $ this -> arrayToUnorderedList ( $ data ) ; break ; } if ( ! $ options [ 'expanded' ] ) { $ id = 'dsd-' . uniqid ( ) ; $ out = $ this -> Html -> link ( $ options [ 'expandLinkText' ] , 'javascript:' , [ 'type' => 'button' , 'data-toggle' => 'collapse' , 'aria-expanded' => 'false' , 'aria-controls' => $ id , 'data-target' => '#' . $ id , ] ) ; $ out .= '<div class="collapse" id="' . $ id . '">' . $ list . '</div>' ; } else { $ out = $ list ; } return $ out ; }
Display an array in human-readable format and provide options to toggle
its display

@param array $data Data to display
@param array $options Options:
- expanded: Whether the data should be shown by default
- expandLinkText: Link text for toggling the content
- callback: A callback used on every entry
@return string
Display an array in human - readable format and provide options to toggle its display