get_contents( $fa_json_file ), true );
$$tpl_fa_icons = array();
$$tpl_fa_icons_s2 = array();
foreach ( $tpl_fa_json["icons"] as $icon ) {
$tpl_fa_icons[$icon["id"]] = array(
"id" => $icon["id"],
"type" => $icon["type"],
"name" => $icon["name"],
);
$tpl_fa_icons_s2[$icon["id"]] = ' ' . $icon["name"];
}
}
$args["values"] = array_merge( array( '' => __( 'Select an Icon', 'tpl' ) ), $tpl_fa_icons_s2 );
if ( !isset( $args["admin_class"] ) ) {
$args["admin_class"] = '';
}
$args["admin_class"] .= ' tpl-dt-select';
parent::__construct( $args );
}
// Writes the form field in wp-admin
public function form_field_content ( $args ) {
global $tpl_fa_icons;
parent::form_field_content( $args );
if ( is_admin() ) {
$icon_type = '';
if ( isset( $tpl_fa_icons[$this->get_option()]["type"] ) ) {
$icon_type = $tpl_fa_icons[$this->get_option()]["type"];
}
echo '';
}
}
// Formats the option into value
public function format_option ( $id, $args = array() ) {
global $tpl_fa_icons;
$result = '';
if ( isset( $args["url"] ) && $args["url"] != '' ) {
$result .= '