| Server IP : 66.29.153.156 / Your IP : 216.73.217.22 Web Server : LiteSpeed System : Linux premium322.web-hosting.com 4.18.0-553.50.1.lve.el8.x86_64 #1 SMP Thu Apr 17 19:10:24 UTC 2025 x86_64 User : lastyfjz ( 1521) PHP Version : 8.1.34 Disable Function : NONE MySQL : OFF | cURL : ON | WGET : ON | Perl : ON | Python : ON | Sudo : OFF | Pkexec : OFF Directory : /home/lastyfjz/./unicitys.com/wp-content/plugins/extendify/app/QuickEdit/Schemas/ |
Upload File : |
<?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;
}
}