__('Text', 'customizing'), 'textarea' => __('Text Area', 'customizing'), 'wysiwyg' => __('WYSIWYG', 'customizing'), 'tel' => __('Phone', 'customizing'), 'email' => __('Email', 'customizing'), 'password' => __('Password', 'customizing'), 'url' => __('URL', 'customizing'), 'number' => __('Number', 'customizing'), 'range' => __('Range', 'customizing'), 'color' => __('Color', 'customizing'), 'checkbox' => __('Checkbox', 'customizing'), 'select' => __('Select', 'customizing'), 'options' => __('Options', 'customizing'), 'time' => __('Time', 'customizing'), 'date' => __('Date', 'customizing'), 'week' => __('Week', 'customizing'), 'month' => __('Month', 'customizing'), ); $field_types=apply_filters('cff-field-types', $field_types); $static_options=array( array( 'id' => 'label', 'label' => __('Label', 'customizing'), 'type' => 'text', 'oninput' => 'cff_change_group_label(this)', 'description' => __('The text to be shown for the user.', 'customizing'), 'span' => 50, ), array( 'id' => 'value', 'label' => __('Value', 'customizing'), 'type' => 'text', 'oninput' => 'cff_slugify_self(this)', 'description' => __('The value of the option.', 'customizing'), 'span' => 50, ), ); $static_options=apply_filters('cff-static-options', $static_options); $post_types=get_post_types(array('public' => true), 'objects'); foreach($post_types as $key => $post_type) $post_types[$key]=$post_type->label; $dynamic_options=array( array( 'id' => 'post-type', 'label' => __('Post Type', 'customizing'), 'type' => 'options', 'options' => $post_types, 'multiple' => true, 'description' => __('Query posts by type.', 'customizing'), ), ); $taxonomies=get_taxonomies(array('public' => true), 'objects'); foreach($taxonomies as $taxonomy) { $args=array( 'taxonomy' => $taxonomy->name, 'hide_empty' => false, ); $terms=get_terms($args); if($terms) { $taxonomy_terms=array(); foreach($terms as $term) $taxonomy_terms[$term->slug]=$term->name; $dynamic_options[]=array( 'id' => $taxonomy->name, 'label' => $taxonomy->label, 'type' => 'options', 'options' => $taxonomy_terms, 'multiple' => true, 'description' => __('Query posts by ', 'customizing').$taxonomy->label, ); } } $dynamic_options=apply_filters('cff-dynamic-options', $dynamic_options); $attributes_settings=array( array( 'id' => 'placeholder', 'label' => __('Placeholder', 'customizing'), 'type' => 'text', 'description' => __('The placeholder attribute specifies a hint that describes '. 'the expected value of an input field.', 'customizing'), 'span' => 50, ), array( 'id' => 'pattern', 'label' => __('Pattern', 'customizing'), 'type' => 'text', 'description' => __('The pattern attribute specifies a regular expression '. 'that the input element\'s value is checked against.', 'customizing'), 'span' => 50, ), array( 'id' => 'min', 'label' => __('Min', 'customizing'), 'type' => 'text', 'description' => __('The min and max attributes specify the '. 'minimum and maximum values for an input element.', 'customizing'), 'span' => 25, ), array( 'id' => 'max', 'label' => __('Max', 'customizing'), 'type' => 'text', 'description' => __('The min and max attributes specify the '. 'minimum and maximum values for an input element.', 'customizing'), 'span' => 25, ), array( 'id' => 'step', 'label' => __('Step', 'customizing'), 'type' => 'number', 'description' => __('The step attribute specifies the legal number '. 'intervals for an input element.', 'customizing'), 'span' => 25, ), array( 'id' => 'span', 'label' => __('Span', 'customizing'), 'type' => 'number', 'min' => 0, 'max' => 100, 'description' => __('The basis width for the element (%).', 'customizing'), 'span' => 25, ), array( 'id' => 'multiple', 'label' => __('Multiple', 'customizing'), 'type' => 'checkbox', 'description' => __('The multiple attribute specifies that the user is allowed '. 'to enter more than one value in the input element.', 'customizing'), 'span' => 25, ), array( 'id' => 'required', 'label' => __('Required'), 'type' => 'checkbox', 'description' => __('The required attribute specifies that an input field '. 'must be filled out before submitting the form.', 'customizing'), 'span' => 25, ), array( 'id' => 'readonly', 'label' => __('Readonly', 'customizing'), 'type' => 'checkbox', 'description' => __('The readonly attribute specifies that the input field '. 'is read only and cannot be changed.', 'customizing'), 'span' => 25, ), array( 'id' => 'repeatable', 'label' => __('Repeatable', 'customizing'), 'type' => 'checkbox', 'description' => __('This attribute specifies that the user is allowed '. 'to duplicate this element in order to enter a list of values.', 'customizing'), 'span' => 25, ), ); $attributes_settings=apply_filters('cff-attributes-settings', $attributes_settings); $fields_settings=array( array( 'id' => 'label', 'label' => __('Label', 'customizing'), 'type' => 'text', 'oninput' => 'cff_change_group_label(this)', 'required' => true, 'description' => __('A text for the field label.', 'customizing'), 'span' => 50, ), array( 'id' => 'id', 'label' => __('ID', 'customizing'), 'type' => 'text', 'pattern' => '[a-z][a-z0-9-]{0,31}', 'oninput' => 'cff_slugify_self(this)', 'required' => true, 'description' => __('The HTML name and id for the field.', 'customizing'), 'span' => 50, ), array( 'id' => 'type', 'label' => __('Type', 'customizing'), 'type' => 'select', 'options' => $field_types, 'description' => __('The input field type.', 'customizing'), 'span' => 50, ), array( 'id' => 'value', 'label' => __('Value', 'customizing'), 'type' => 'text', 'description' => __('The value attribute specifies the initial value for an input field.', 'customizing'), 'span' => 50, ), array( 'id' => 'description', 'label' => __('Description', 'customizing'), 'type' => 'textarea', 'description' => __('A text for the field description.', 'customizing'), 'span' => 100, ), array( 'id' => 'static-options', 'label' => __('Static Options', 'customizing'), 'dlabel' => 'label', 'slabel' => __('New Option', 'customizing'), 'type' => 'group', 'fields' => $static_options, 'accordion' => true, 'repeatable' => true, 'description' => __('A list of options for the select or options field.', 'customizing'), 'span' => 100, ), array( 'id' => 'dynamic-options', 'slabel' => __('Dynamic Options', 'customizing'), 'type' => 'group', 'fields' => $dynamic_options, 'accordion' => true, 'description' => __('Dynamic options for a custom query.', 'customizing'), 'span' => 100, ), array( 'id' => 'attributes', 'slabel' => __('Attributes', 'customizing'), 'type' => 'group', 'fields' => $attributes_settings, 'accordion' => true, 'description' => __('Attributes for the input field.', 'customizing'), 'span' => 100, ), ); $fields=array( 'id' => 'cff-fields', //'label' => __('Fields', 'customizing'), 'slabel' => __('New Field', 'customizing'), 'dlabel' => 'label', 'type' => 'group', 'fields' => $fields_settings, 'repeatable' => true, 'description' => __('List of custom fields settings.', 'customizing'), ); return $fields; } /** @brief Gets the dashicons for the menu. @since 1.3.0 */ function cff_get_menu_icons() { $menu_icons=array(); $dashicons=file(__DIR__.'/dashicons.txt', FILE_IGNORE_NEW_LINES); foreach($dashicons as $dashicon) $menu_icons[$dashicon]=''; return $menu_icons; } ?>