-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathhogan-expandable-list.php
More file actions
61 lines (54 loc) · 1.74 KB
/
hogan-expandable-list.php
File metadata and controls
61 lines (54 loc) · 1.74 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
<?php
/**
* Plugin Name: Hogan Module: Expandable List
* Plugin URI: https://github.com/dekodeinteraktiv/hogan-expandable-list
* GitHub Plugin URI: https://github.com/dekodeinteraktiv/hogan-expandable-list
* Description: Expandable List Module for Hogan
* Version: 1.2.2
* Author: Dekode
* Author URI: https://dekode.no
* License: GPL-3.0
* License URI: https://www.gnu.org/licenses/gpl-3.0.en.html
*
* Text Domain: hogan-expandable-list
* Domain Path: /languages/
*
* @package Hogan
* @author Dekode
*/
declare( strict_types = 1 );
namespace Dekode\Hogan\Expandable_List;
if ( ! defined( 'ABSPATH' ) ) {
exit; // Exit if accessed directly.
}
define( 'HOGAN_EXPANDABLE_LIST_VERSION', '1.2.2' );
add_action( 'plugins_loaded', __NAMESPACE__ . '\\hogan_load_textdomain' );
add_action( 'hogan/include_modules', __NAMESPACE__ . '\\register_module', 10, 1 );
add_filter( 'acf/update_value/key=hogan_module_expandable_list_item_id', __NAMESPACE__ . '\\sanitize_item_id_on_save', 10, 3 );
/**
* Register module text domain
*/
function hogan_load_textdomain() {
\load_plugin_textdomain( 'hogan-expandable-list', false, dirname( plugin_basename( __FILE__ ) ) . '/languages' );
}
/**
* Register module in Hogan
*
* @param \Dekode\Hogan\Core $core Hogan Core instance.
* @return void
*/
function register_module( \Dekode\Hogan\Core $core ) {
require_once 'class-expandable-list.php';
$core->register_module( new \Dekode\Hogan\Expandable_List() );
}
/**
* Sanitize item id name to URL friendly string.
*
* @param string $value Item name.
* @param integer $id Item id.
* @param array $field Sanitized item name.
* @return string
*/
function sanitize_item_id_on_save( string $value, int $id, array $field ) : string {
return sanitize_title( $value );
}