Jump to content
bigdawggi

Saving values from custom option "types"

Recommended Posts

bigdawggi    0
bigdawggi

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:
do_action( 'pagelines_options_' . $o['type'] , $oid, $o);
 
...but I'm falling short on finding where to save the option's values.
 
Thanks in advance!

Share this post


Link to post
Share on other sites
James B    436
James B

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 http://developer.pagelines.com/apply/


Kindly search the forum and read the documentation before posting. It will help you resolve many issues.

For CSS help be sure to check out W3Schools first and be sure to download FireBug for FireFox for troubleshooting.

James B

Share this post


Link to post
Share on other sites
bigdawggi    0
bigdawggi

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!

Share this post


Link to post
Share on other sites
Simon    247
Simon

Why not use a dropdown of all available types?

Share this post


Link to post
Share on other sites
bigdawggi    0
bigdawggi

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.

Share this post


Link to post
Share on other sites
bigdawggi    0
bigdawggi

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!

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now


  • Similar Content

    • oseehys
      By oseehys+
      Hello There,
      So i want to use platform 5 and DMS sections on a single page, i am using a child theme with pinspro as my main theme and i activated platform 5, the only problem am having so far is the fixed option, my navbars are not aligning to their default size, and it will be great if platform 5 header and footer section will function, has anyone used this option, how can i make the best use of platform 5 and DMS on a site
      Cheers
    • yemoonyah
      By yemoonyah+
      Hi,
      I tried to make a simple change on my opt-in page today by reordering two sections.
      Now they won't save and whatever I do, the same 2 section will be stuck to the top.
      This is a huge problem since it is my opt-in page!
      http://yemoonyah.com/quiz
      (I'm on the latest WP & PL version)
      Thanks.
       
    • Anthony King
      By Anthony King+
      I have to say that I like the Layout and the Template based sections. Some of them are really impressive.
      One of the things that I would like to request though is the possibility of being able to dynamically rearrange the layout.
      An example of what I am talking about is take the Agency Section. It's current layout starts with the
      Splash Module then the Portfolio Module then the Service Module and so on and so forth.
      What would be great is if we were able to move these modules around. I.e have the Service Module first
      then maybe the Splash, and then the portfolio.
       
    • nandorj78
      By nandorj78+
      This discussion has appeared today on the Facebook User Group and we decided to have a vote to know what the users judge more important.
      Let me know which questions you want me to add to the poll.
    • chrisayers
      By chrisayers+
       
      Post Deleted...

×