type = $type; $this->name = $name; $this->label = $label; $this->description = $description; $this->options = $options; $this->args = $args; $this->hidden_property = $hidden_property; $this->hidden_values = $hidden_values; add_filter( 'calla_elated_taxonomy_fields', array( $this, 'addFieldForEditSave' ) ); } public function addFieldForEditSave( $names ) { //for icon type of field add additonal icon font family based names for saving if ( $this->type == 'icon' ) { $icons_collections = \CallaElatedIconCollections::get_instance()->getIconCollectionsKeys(); foreach ( $icons_collections as $icons_collection ) { $icons_param = \CallaElatedIconCollections::get_instance()->getIconCollectionParamNameByKey( $icons_collection ); $names[] = $this->name . '_' . $icons_param; } } $names[] = $this->name; return $names; } public function render( $factory ) { $hidden = false; if (isset( $_GET['tag_ID'] ) ) { if ( ! empty( $this->hidden_property ) ) { foreach ( $this->hidden_values as $value ) { if ( get_term_meta( $_GET['tag_ID'], $this->hidden_property, true ) == $value ) { $hidden = true; } } } } $factory->render( $this->type, $this->name, $this->label, $this->description, $this->options, $this->args, $hidden ); } } abstract class CallaElatedTaxonomyFieldType { abstract public function render( $name, $label = "", $description = "", $options = array(), $args = array() ); } class CallaElatedTaxonomyFieldText extends CallaElatedTaxonomyFieldType { public function render( $name, $label = "", $description = "", $options = array(), $args = array(), $hidden = false ) { if ( ! isset( $_GET['tag_ID'] ) ) { ?>

style="display: none">

style="display: none">

style="display: none">

getIconCollectionsEmpty(); $icons_collections = \CallaElatedIconCollections::get_instance()->getIconCollectionsKeys(); if ( ! isset( $_GET['tag_ID'] ) ) { ?>

getIconCollectionParamNameByKey( $icons_collection ); ?> style="display: none">

getIconCollectionParamNameByKey( $icons_collection ); $style = 'display:none'; if ( $icon_pack == $icons_collection ) { $style = 'display:table-row'; } ?>

style="display: none">

render( $name, $label, $description, $options, $args, $hidden ); break; case 'image': $field = new CallaElatedTaxonomyFieldImage(); $field->render( $name, $label, $description, $options, $args, $hidden ); break; case 'selectblank': $field = new CallaElatedTaxonomyFieldSelect(); $field->render( $name, $label, $description, $options, $args, $hidden ); break; case 'icon': $field = new CallaElatedTaxonomyFieldIcon(); $field->render( $name, $label, $description, $options, $args, $hidden ); break; case 'color': $field = new CallaElatedTaxonomyFieldColor(); $field->render( $name, $label, $description, $options, $args, $hidden ); break; default: break; } } }