l10n_domain = acf_nggallery_field_plugin::L10N_DOMAIN; // vars $this->name = 'nggallery-field'; $this->category = __("Relational", 'acf'); // Basic, Content, Choice, etc $post_title = ( !class_exists('nggdb') ) ? '. ' . __( 'NextGEN Gallery plugin is not installed or activated!', $this->l10n_domain ) : false; $this->title = __( 'NextGEN Gallery'.$post_title, $this->l10n_domain ); $this->label = __( 'NextGEN Gallery'.$post_title, $this->l10n_domain ); $this->defaults = array( 'input_type' => 'select' , 'allow_null' => true , 'input_size' => 5 , 'nextgen_type' => 'Galleries and Albums' ); // do not delete! parent::__construct(); // settings $this->settings = array( 'path' => apply_filters('acf/helpers/get_path', __FILE__) , 'dir' => apply_filters('acf/helpers/get_dir', __FILE__) , 'version' => '1.0.0' ); } /* * 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 ) { $field = array_merge($this->defaults, $field); $key = $field['name']; ?> 'radio' , 'name' => 'fields['.$key.'][allow_null]' , 'value' => $field['allow_null'] , 'layout' => 'horizontal' , 'choices' => array( '1' => __( 'Yes', $this->domain ) , '0' => __( 'No', $this->domain ) ) ) ); ?>

domain ); ?>

'select' , 'name' => 'fields['.$key.'][nextgen_type]' , 'value' => $field['nextgen_type'] , 'layout' => 'horizontal' , 'class' => "nggallery_nextgen_type nggallery_nextgen_type_{$key}" , 'choices' => array( 'Galleries and Albums' => __( 'Galleries and Albums', $this->domain ) , 'Galleries' => __( 'Galleries', $this->domain ) , 'Albums' => __( 'Albums', $this->domain ) ) ) ); ?>

domain ); ?>

'select' , 'name' => 'fields['.$key.'][input_type]' , 'value' => $field['input_type'] , 'layout' => 'horizontal' , 'class' => "nggallery_input_type nggallery_input_type_{$key}" , 'choices' => array( 'select' => __( 'Select', $this->domain ) , 'multiselect' => __( 'Multi-Select', $this->domain ) ) ) ); ?>

domain ); ?>

'select' , 'name' => 'fields['.$key.'][input_size]' , 'value' => $field['input_size'] , 'layout' => 'horizontal' , 'choices' => array_combine( range( 3, 15, 2 ), range( 3, 15, 2 ) ) ) ); ?> find_all_galleries( $order_by, $order_dir , TRUE, $limit, $start, false); $albumlist = $nggdb->find_all_album( 'name', $order_dir, $limit, $start); ?> defaults, $field ); // extract( $field, EXTR_SKIP ); //Declare each item in $field as its own variable i.e.: $name, $value, $label, $time_format, $date_format and $show_week_number $values = array(); foreach( $value as $key=>$item ) { $items = explode( ',', $item ); foreach( $items as $item ) { if ( is_numeric( $item ) ) $values[$key]['ngg_id'] = intval ( $item ); else $values[$key]['ngg_form'] = strval( $item ); } } return $values; } /* * format_value_for_api() * * This filter is applied to the $value after it is loaded from the db and before it is passed back to the api functions such as the_field * * @type filter * @since 3.6 * @date 23/01/13 * * @param $value - the value which was loaded from the database * @param $post_id - the $post_id from which the value was loaded * @param $field - the field array holding all the field options * * @return $value - the modified value */ function format_value_for_api( $value, $post_id, $field ) { if ( $value[0]['ngg_form'] == 'null' ) { $value = false; } return $value; } } // create field new ACF_NGGallery_Field(); ?>