Exemplo n.º 1
0
function getItem($field, $options)
{
    $item_id = $options['i'];
    $value = $options['value'];
    ?>
    <div class="well item item-<?php 
    echo $item_id;
    ?>
">
        <div class="add-item"><i class="icon-plus-circle"></i></div>
        <div class="remove-item"><i class="icon-times-circle"></i></div>

        <?php 
    // loop through each of the fields
    foreach ($options['fields'] as $itemField) {
        $fieldName = $field . '[' . $item_id . '][' . $itemField["dataname"] . ']';
        isset($value[$itemField["dataname"]]) ? $itemValue = $value[$itemField["dataname"]] : ($itemValue = NULL);
        isset($itemField['type']) ? $itemType = $itemField['type'] : ($itemType = 'input');
        isset($itemField['title']) ? $itemTitle = $itemField['title'] : ($itemTitle = NULL);
        isset($itemField['required']) ? $itemRequired = $itemField['required'] : ($itemRequired = false);
        isset($itemField['description']) ? $itemDescription = $itemField['description'] : ($itemDescription = NULL);
        isset($itemField['options']) ? $itemOpts = $itemField['options'] : ($itemOpts = NULL);
        isset($itemField['args']) ? $itemArgs = $itemField['args'] : ($itemArgs = NULL);
        isset($itemField['secondary_type']) ? $itemSecondaryType = $itemField['secondary_type'] : ($itemSecondaryType = NULL);
        isset($itemField['taxonomy']) ? $itemTaxonomy = $itemField['taxonomy'] : ($itemTaxonomy = NULL);
        // clear the array
        $itemOptions = '';
        // set-up new options to pass on to meta-fields.php
        $itemOptions = array('title' => $itemTitle, 'required' => $itemRequired, 'description' => $itemDescription, 'type' => $itemType, 'dataname' => $itemField["dataname"], 'value' => $itemValue, 'options' => $itemOpts, 'args' => $itemArgs, 'secondary_type' => $itemSecondaryType, 'taxonomy' => $itemTaxonomy);
        ?>
            <?php 
        if ($itemType == 'images' || $itemType == 'image') {
            $itemOptions['og_field'] = $field;
            $itemOptions['i'] = $item_id;
            isset($value[$itemField["dataname"] . 'FeaturedIMG']) ? $itemOptions['featured_value'] = $value[$itemField["dataname"] . 'FeaturedIMG'] : ($itemOptions['featured_value'] = '');
            $itemOptions['meta-items'] = true;
            metaField($fieldName, $itemOptions);
        } else {
            metaField($fieldName, $itemOptions);
        }
    }
    ?>

    </div>
<?php 
}
Exemplo n.º 2
0
function service_details()
{
    metaField('_needsBeforeStart', array('type' => 'editor', 'title' => 'What we need to get started'));
}
Exemplo n.º 3
0
function metaOption($field, $options = array())
{
    // set it to be data option
    $defaultOptions = array('data' => 'option');
    //merge the array
    $options = array_merge($defaultOptions, $options);
    // pass it on to the metaField for processing
    metaField($field, $options);
}