diff --git a/.gitignore b/.gitignore index 485dee6..f2ecd3c 100644 --- a/.gitignore +++ b/.gitignore @@ -1 +1,2 @@ .idea +vendor/ diff --git a/acf-native-field-type.php b/acf-native-field-type.php index 16f759d..5857085 100644 --- a/acf-native-field-type.php +++ b/acf-native-field-type.php @@ -1,79 +1,93 @@ name = 'native_field'; - $this->label = __('Native Field', 'acf-native-fields'); + $this->label = __( 'Native Field', 'acf-native-fields' ); $this->defaults = array( - 'value' => false, // prevents acf_render_fields() from attempting to load value + 'value' => false, // prevents acf_render_fields() from attempting to load value ); - + $this->category = 'layout'; - + $this->l10n = array( - 'not_implemented' => __('Native Field not implemented yet.', 'acf-native-fields'), + 'not_implemented' => __( 'Native Field not implemented yet.', 'acf-native-fields' ), ); - parent::__construct(); + parent::__construct(); } - - function render_field_settings($field) { - acf_render_field_setting($field, array( - 'label' => __('Native Field', 'acf-native-fields'), - 'instructions' => __('The native WordPress field to move into this placeholder.', 'acf-native-fields'), - 'type' => 'select', - 'name' => 'native_field', - 'required' => 1, - // TODO: Implement backend and frontend functionality for custom native fields (hooks) - 'choices' => array( - 'content' => __('Content Editor', 'acf-native-fields'), - 'excerpt' => __('Excerpt', 'acf-native-fields'), - 'featured_image' => __('Featured Image', 'acf-native-fields'), - 'yoast_seo' => __('SEO (Yoast or SEO framework)', 'acf-native-fields'), - 'publish_box' => __('Publish Box', 'acf-native-fields'), - 'permalink' => __('Permalink', 'acf-native-fields'), - 'discussion' => __('Discussion', 'acf-native-fields'), - 'trackbacks' => __('Trackbacks', 'acf-native-fields'), - 'format' => __('Format', 'acf-native-fields'), - 'page_attributes' => __('Page Attributes', 'acf-native-fields'), - 'custom' => __('Custom', 'acf-native-fields'), - ), - )); - acf_render_field_setting($field, array( - 'label' => __('Custom Meta Box ID', 'acf-native-fields'), - 'instructions' => __('The ID of the custom metabox to target.', 'acf-native-fields'), - 'type' => 'text', - 'name' => 'metabox_id', - 'prefix' => '#', - 'conditional_logic' => array( - array( + function render_field_settings( $field ) { + acf_render_field_setting( + $field, + array( + 'label' => __( 'Native Field', 'acf-native-fields' ), + 'instructions' => __( 'The native WordPress field to move into this placeholder.', 'acf-native-fields' ), + 'type' => 'select', + 'name' => 'native_field', + 'required' => 1, + // TODO: Implement backend and frontend functionality for custom native fields (hooks) + 'choices' => array( + 'content' => __( 'Content Editor', 'acf-native-fields' ), + 'excerpt' => __( 'Excerpt', 'acf-native-fields' ), + 'featured_image' => __( 'Featured Image', 'acf-native-fields' ), + 'yoast_seo' => __( 'SEO (Yoast or SEO framework)', 'acf-native-fields' ), + 'publish_box' => __( 'Publish Box', 'acf-native-fields' ), + 'permalink' => __( 'Permalink', 'acf-native-fields' ), + 'discussion' => __( 'Discussion', 'acf-native-fields' ), + 'trackbacks' => __( 'Trackbacks', 'acf-native-fields' ), + 'format' => __( 'Format', 'acf-native-fields' ), + 'page_attributes' => __( 'Page Attributes', 'acf-native-fields' ), + 'custom' => __( 'Custom', 'acf-native-fields' ), + ), + ) + ); + + acf_render_field_setting( + $field, + array( + 'label' => __( 'Custom Meta Box ID', 'acf-native-fields' ), + 'instructions' => __( 'The ID of the custom metabox to target.', 'acf-native-fields' ), + 'type' => 'text', + 'name' => 'metabox_id', + 'prefix' => '#', + 'conditional_logic' => array( array( - 'field' => 'native_field', - 'operator' => '==', - 'value' => 'custom', + array( + 'field' => 'native_field', + 'operator' => '==', + 'value' => 'custom', + ), ), ), - ), - )); + ) + ); } - - function render_field($field) {?> -