name = 'page_link'; $this->label = __("Page Link",'acf'); $this->category = __("Relational",'acf'); $this->defaults = array( 'post_type' => array('all'), 'multiple' => 0, 'allow_null' => 0, ); // do not delete! parent::__construct(); } /* * load_field() * * This filter is appied to the $field after it is loaded from the database * * @type filter * @since 3.6 * @date 23/01/13 * * @param $field - the field array holding all the field options * * @return $field - the field array holding all the field options */ function load_field( $field ) { // validate post_type if( !$field['post_type'] || !is_array($field['post_type']) || in_array('', $field['post_type']) ) { $field['post_type'] = array( 'all' ); } // return return $field; } /* * create_field() * * Create the HTML interface for your field * * @param $field - an array holding all the field's data * * @type action * @since 3.6 * @date 23/01/13 */ function create_field( $field ) { // let post_object create the field $field['type'] = 'post_object'; do_action('acf/create_field', $field ); } /* * create_options() * * Create extra options for your field. This is rendered when editing a field. * The value of $field['name'] can be used (like bellow) to save extra data to the $field * * @type action * @since 3.6 * @date 23/01/13 * * @param $field - an array holding all the field's data */ function create_options( $field ) { $key = $field['name']; ?> __("All",'acf') ); $choices = apply_filters('acf/get_post_types', $choices); do_action('acf/create_field', array( 'type' => 'select', 'name' => 'fields['.$key.'][post_type]', 'value' => $field['post_type'], 'choices' => $choices, 'multiple' => 1, )); ?> 'radio', 'name' => 'fields['.$key.'][allow_null]', 'value' => $field['allow_null'], 'choices' => array( 1 => __("Yes",'acf'), 0 => __("No",'acf'), ), 'layout' => 'horizontal', )); ?> 'radio', 'name' => 'fields['.$key.'][multiple]', 'value' => $field['multiple'], 'choices' => array( 1 => __("Yes",'acf'), 0 => __("No",'acf'), ), 'layout' => 'horizontal', )); ?> $v ) { $value[ $k ] = get_permalink($v); } } else { $value = get_permalink($value); } return $value; } } new acf_field_page_link(); ?>