PluginProbe
Extendify / 3.1.5
Extendify v3.1.5
3.2.1 3.2.0 3.1.6 3.1.5 3.1.4 3.1.3 3.1.2 3.1.1 3.1.0 3.0.6 3.0.5 3.0.4 trunk 0.1.0 0.10.0 0.10.1 0.10.2 0.11.0 0.11.1 0.2.0 0.3.0 0.3.1 0.4.0 0.5.0 0.6.0 All 127 releases
extendify / app / QuickEdit / Schemas / SocialLink.php

SocialLink.php in Extendify 3.1.5, at app/QuickEdit/Schemas/SocialLink.php

36 lines 815 B
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2
3 namespace Extendify\QuickEdit\Schemas;
4
5 defined('ABSPATH') || die('No direct access.');
6
7 class SocialLink implements Schema
8 {
9 public function fields(): array
10 {
11 return [
12 [
13 'key' => 'url',
14 'control' => 'link',
15 'label' => __('Link URL', 'extendify-local'),
16 ],
17 ];
18 }
19
20 public function apply(array $block, string $fieldKey, $value): array
21 {
22 if ($fieldKey !== 'url') {
23 return $block;
24 }
25 $url = is_string($value) ? esc_url_raw($value) : '';
26 $attrs = $block['attrs'] ?? [];
27 if ($url === '') {
28 unset($attrs['url']);
29 } else {
30 $attrs['url'] = $url;
31 }
32 $block['attrs'] = $attrs;
33 return $block;
34 }
35 }
36