Jump to content


Photo
- - - - -

Saving values from custom option "types"

options sections custom options option type

Best Answer bigdawggi , 11 January 2013 - 09:18 PM

So after a long break I was able to get back to this and realized that the field just needed the proper name -- which comes from the $o (option element defined in the `section_optionator()` function.

 

Example defining option:

 

 
$options = array(
  'galleries' => array(
    'title' => 'Gallery',
    'type' => 'gallery_type_ahead',
    'inputlabel' => 'Gallery',
    'exp' => 'Start typing the name of the gallery you want to display.',
    'shortexp' => 'Pick your gallery you want to display.'
  ),
);

 

 

And now to output in the section admin

 
foreach ($o['val'] as $key => $gallery_id) {
  ?>
  <li>
    <input type="text" id="<?php echo esc_attr($o['input_id'].'-'.$key); ?>" name="<?php echo esc_attr($o['input_name']); ?>[]" class="gallery-typeahead" value="<?php echo intval($gallery_id); ?>" />
  </li>
  <?php
}

I believe I had been trying the $oid variable instead of the $o (which I know understand, stands for option).  Baby steps ;)

 

Now my question is how to validate the entered values, but I'll look around for that.

 

Thanks for everyones help!

Go to the full post


This topic has been archived. This means that you cannot reply to this topic.
5 replies to this topic

#1 bigdawggi

bigdawggi

    Member

  • Members
  • 13 posts

Posted 02 January 2013 - 06:32 PM

Howdy, I'm making a custom section and it needs a type-ahead box that searches for other custom post types to feature in it. The big question is how I save a custom option 'type' values (i.e., not one of the built-in "text", "checkbox", etc).

 
I've looked through the "pagelines-section-template" code, and watched the YouTube tutorials, but those all give examples of a "text" option type, not a custom one.  
 
I found the action inside `class.options.engine.php` for outputting the custom option type (below), so that's not a problem:

Please Login or Register to see this Hidden Content

 
...but I'm falling short on finding where to save the option's values.
 
Thanks in advance!


#2 James B†

James B

    Advocate

  • DMS Subscriber†
  • 5126 posts

Posted 03 January 2013 - 05:20 AM

Hi there,

 

I'll speak to a member of the developer team to see if they can point you in the right direction and come back to you once I hear from them.

 

If you're looking into making a custom sections, you should look into signing up to our Junto/developer group

Please Login or Register to see this Hidden Content



#3 bigdawggi

bigdawggi

    Member

  • Members
  • 13 posts

Posted 03 January 2013 - 02:23 PM

Thanks James, I've done that as well and am waiting for their approval of my application.  If there's a way to hasten that process I'm game for that route too ;)

 

I look fwd to their reply!  Thanks!



#4 Simon_P

Simon_P

    Messer

  • Administrators



  • 8388607 posts

Posted 04 January 2013 - 10:24 PM

Why not use a dropdown of all available types?



#5 bigdawggi

bigdawggi

    Member

  • Members
  • 13 posts

Posted 04 January 2013 - 11:49 PM

Thanks Simon_P, but it's not to make available the listing of custom post types; The end result is to provide the user the ability to select multiple individual post type items.  

 

Example: 

There's a post type of videos

This section would allow the editors to type inside it for the name of a singular video; then click "+" to add another input to search for another video to populate this section with, and so on.

 

I haven't seen a section that allows for that type of functionality.

 

The issue I was having (and haven't been able to go back and test more yet) is the saving of the values of those text inputs that will contain the titles/ids of those videos.



#6 bigdawggi

bigdawggi

    Member

  • Members
  • 13 posts

Posted 11 January 2013 - 09:18 PM   Best Answer

So after a long break I was able to get back to this and realized that the field just needed the proper name -- which comes from the $o (option element defined in the `section_optionator()` function.

 

Example defining option:

 

Please Login or Register to see this Hidden Content

 

 

And now to output in the section admin

Please Login or Register to see this Hidden Content

I believe I had been trying the $oid variable instead of the $o (which I know understand, stands for option).  Baby steps ;)

 

Now my question is how to validate the entered values, but I'll look around for that.

 

Thanks for everyones help!