HEX
Server: LiteSpeed
System: Linux dviragis.serveriai.lt 5.14.0-687.26.1.el9_8.x86_64 #1 SMP PREEMPT_DYNAMIC Tue Jul 14 16:32:02 EDT 2026 x86_64
User: lyrlavhsb (1106)
PHP: 8.3.19
Disabled: link, symlink, exec, passthru, proc_close, proc_get_status, proc_open, shell_exec, system, popen, pclose, dl, show_source, highlight_file, pcntl_exec, ini_restore, ini_alter, chgrp
Upload Files
File: /home/lyrlavhsb/public_html/wp-content/plugins/extendify/app/QuickEdit/Schemas/NavigationLink.php
<?php

namespace Extendify\QuickEdit\Schemas;

defined('ABSPATH') || die('No direct access.');

// Nav links inside a core/navigation with a `ref` attribute live in a
// wp_navigation post, not post_content; not yet supported. Inline
// core/navigation-link children of an inline core/navigation work normally.
class NavigationLink implements Schema
{
    public function fields(): array
    {
        return [
            [
                'key'     => 'label',
                'control' => 'text',
                'label'   => __('Label', 'extendify-local'),
            ],
            [
                'key'     => 'url',
                'control' => 'link',
                'label'   => __('Destination', 'extendify-local'),
            ],
        ];
    }

    public function apply(array $block, string $fieldKey, $value): array
    {
        $attrs = $block['attrs'] ?? [];
        switch ($fieldKey) {
            case 'label':
                $label = is_string($value) ? wp_strip_all_tags($value) : '';
                $attrs['label'] = $label;
                break;
            case 'url':
                $url = is_string($value) ? esc_url_raw($value) : '';
                if ($url === '') {
                    unset($attrs['url']);
                } else {
                    $attrs['url'] = $url;
                }
                break;
            default:
                return $block;
        }
        $block['attrs'] = $attrs;
        return $block;
    }
}