/*
render_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
549871
function render_field( $field ) {

		$maxrows = null;

		$disablesort = null;

		$defaultheaders = null;


		// vars
		$o = array( 'id', 'name' );
		$s = array( 'readonly', 'disabled' );
		$e = '';


		// maxlength
		if( $field['maxrows'] !== '' ) {

			$maxrows = 'data-maxrows="'.$field['maxrows'].'"';

		}

						// disable sort
		if( !empty($field['disable_sort']) ) $disablesort = ' data-disablesort="'.$field['disable_sort'].'"';

		// rows
		if( !empty($field['fixed_columns']) ) {

			$defaultheaders = preg_split( '/\r\n|\r|\n/',  $field['default_headers'] );

			$defaultheaders = 'data-defaultheaders="'.implode(",", $defaultheaders) .'"';
			if( empty($field['default_headers']) ) $defaultheaders = 'data-defaultheaders="No Default Headers Set"';

		}




		// populate atts
		$atts = array();
		foreach( $o as $k ) {

			$atts[ $k ] = $field[ $k ];

		}



		// special atts
		foreach( $s as $k ) {

			if( $field[ $k ] ) {

				$atts[ $k ] = $k;

			}

		}



		$e .= '<textarea style="display:none" '.$maxrows.' '.$disablesort.' '.$defaultheaders.' data-key="'.$field['key'].'" ' . acf_esc_attr( $atts ) . ' >';
		$e .= esc_textarea( $field['value'] );
		$e .= '</textarea>';


		// return
		echo $e;

	}
1308129
function(field,renderType){
			var gridCompColumn = this.getColumnByField(field);
			gridCompColumn.options.renderType = renderType;
			var index = this.getIndexOfColumn(gridCompColumn);
			this.renderTypeByColumn(gridCompColumn,index);
		}
723155
public function addField(Field $field)
    {
        if (array_search($field, $this->fields) === false)
            $this->fields[] = $field;
    }
763588
public function renderInput($table, string $field, $data = '', array $options = []) : string
    {
        $handler = self::getByTableField($table, $field, $options, $this->cakeView);

        return $handler->renderInput($data, $options);
    }
919806
public function renderField()
    {
        list($name, $id) = $this->resolveNameID();

        TbArray::defaultValue('id', $id, $this->htmlOptions);
        TbArray::defaultValue('name', $name, $this->htmlOptions);

        if ($this->hasModel()) {
            echo $this->asDropDownList ?
                TbHtml::activeDropDownList($this->model, $this->attribute, $this->data, $this->htmlOptions) :
                TbHtml::activeHiddenField($this->model, $this->attribute);

        } else {
            echo $this->asDropDownList ?
                TbHtml::dropDownList($this->name, $this->value, $this->data, $this->htmlOptions) :
                TbHtml::hiddenField($this->name, $this->value);
        }
    }
845402
public function renderField()
    {
        list($name, $id) = $this->resolveNameID();

        TbArray::defaultValue('id', $id, $this->htmlOptions);
        TbArray::defaultValue('name', $name, $this->htmlOptions);

        // fixes #32: 'multiple' will be forced later in jQuery plugin
        $this->htmlOptions['multiple'] = 'multiple';

        if ($this->hasModel()) {
            echo CHtml::activeDropDownList($this->model, $this->attribute, $this->data, $this->htmlOptions);
        } else {
            echo CHtml::dropDownList($this->name, $this->value, $this->data, $this->htmlOptions);
        }
    }
671294
public function create_field($field)
    {
        $field['choices'] = $this->post_type_options();

        // value must be array
        if (!is_array($field['value'])) {
            // perhaps this is a default value with new lines in it?
            if (strpos($field['value'], "\n") !== false) {
                // found multiple lines, explode it
                $field['value'] = explode("\n", $field['value']);
            } else {
                $field['value'] = array( $field['value'] );
            }
        }

        // trim value
        $field['value'] = array_map('trim', $field['value']);

        // multiple select
        $multiple = '';
        if ($field['multiple']) {
            // create a hidden field to allow for no selections
            echo '<input type="hidden" name="' . $field['name'] . '" />';

            $multiple = ' multiple="multiple" size="5" ';
            $field['name'] .= '[]';
        }

        // html
        echo '<select id="' . $field['id'] . '" class="' . $field['class'] .
            '" name="' . $field['name'] . '" ' . $multiple . ' >';

        // null
        if ($field['allow_null']) {
            echo '<option value="null">- ' . __("Select", 'acf') . ' -</option>';
        }

        // loop through values and add them as options
        foreach ($field['choices'] as $choice) {
            $selected = in_array($choice['value'], $field['value']) ? 'selected="selected"' : '';
            echo '<option value="'.$choice['value'].'" '.$selected.'>'.$choice['label'].'</option>';
        }

        echo '</select>';
    }
338767
public function renderFields($type, $fields = [])
    {
        if (empty($fields)) {
            $fields = $this->getFields();
        }
        $output = '';

        switch ($type) {
        case 'form-create':
            $output .= $this->fieldHelper->formCreate($fields);
            break;
        case 'form-edit':
            $output .= $this->fieldHelper->formEdit($fields);
            break;
        case 'table-headings':
            $output .= $this->fieldHelper->tableHeadings($fields);
            break;
        case 'table-content':
            $output .= $this->fieldHelper->tableContent($fields, $this->instance);
            break;
            // JavaScript Variables
        case 'js-var':
            foreach ($fields as $f) {
                $output .= 'var '.$f.' = '.$this->instance->$f.'; ';
            }
            break;
        case 'js-modal-create':
            foreach ($fields as $f) {
                $output .= '"'.$f.'": $(\'#createItem'.$f.'\').val(), ';
            }
            break;
        default:
            break;
        }

        echo $output;
    }
1126606
public function renderFields()
    {
        // Save fields in DB
        $this->saveFields();

        // Get contents
        $pageCurrent = $this->currentPage;
        $sectionCurrent = $this->currentSection;
        $formFields = $this->fields;
        $contentOptions = $this->options;

        // Get links
        $u_link = 'page='.$pageCurrent;
        $u_section = !empty($sectionCurrent) ? '&section='.$sectionCurrent : '';

        // Work on vars
        $vars = [
            'title'         => $contentOptions['title'],
            'description'   => $contentOptions['description'],
            'submit'        => $contentOptions['submit'],

            // Texts and URLs
            't_submit'      => Translate::t('adminpage.submit'),
            'u_link'        => $u_link,
            'u_action'      => admin_url('admin.php?'.$u_link.$u_section),
        ];

        // Display sections
        if (!empty($contentOptions['sections']) && is_array($contentOptions['sections'])) {
            foreach ($contentOptions['sections'] as $slug => $opts) {
                // Update option
                $opts['slug'] = $slug;
                $opts['u_link'] = admin_url('admin.php?'.$u_link.'&section='.$slug);

                // Update vars
                $vars['sections'][] = $opts;

                if ($slug !== $sectionCurrent) {
                    continue;
                }

                // Update vars
                $vars['submit'] = $opts['submit'];
            }
        }

        // Work on current vars
        $vars['c_page'] = $pageCurrent;
        $vars['c_section'] = $sectionCurrent;

        // Display fields
        if (!empty($formFields)) {
            foreach ($formFields as $field) {
                if (!$field) {
                    continue;
                }

                $vars['fields'][] = $field->render([], [
                    'template' => 'adminpage',
                ], false);
            }
        }

        // Render view
        Render::view('adminpage.html.twig', $vars, 'adminpage');
    }
455905
function forms_html($form, $field)
	{
		$value = isset($form->values[$field['name']]) ?
			$form->values[$field['name']] :
			(isset($field['value'])?$field['value']:'');
		$preset = isset($field['preset']) ? $field['preset'] : 'default';
		$result = "\t\t" . '<tr><td colspan="2">' . $field['label'] .
			'<br /><textarea name="wyswyg_' . $field['name'] . '" class="tinymce_' . $preset .
			'" cols="80" rows="25" style="width: 100%; height: ' .
			$field['height'].';">'.str_replace('$(httpRoot)', Eresus_CMS::getLegacyKernel()->root,
			EncodeHTML($value)).'</textarea></td></tr>'."\n";

		if (!self::$scriptsInstalled)
		{
			Eresus_Kernel::app()->getPage()->linkScripts($this->root.'tiny_mce.js');
			Eresus_Kernel::app()->getPage()->linkScripts($this->root.'presets/'.$preset.'.js');
			self::$scriptsInstalled = true;
		}

		return $result;
	}
271821
function create_field( $field )
	{
		// vars
		$o = array(
			'class'		=>	'',
			'url'		=>	'',
		);
		
		
		// has value?
		if( $field['value'] && is_numeric($field['value']) ) {
			
			$url = wp_get_attachment_image_src($field['value'], $field['preview_size']);
			
			if( $url ) {
				
				$o['url'] = $url[0];
				$o['class'] = 'active';
			
			}
						
		}
		
		?>
<div class="acf-image-uploader clearfix <?php echo $o['class']; ?>" data-preview_size="<?php echo $field['preview_size']; ?>" data-library="<?php echo $field['library']; ?>" >
	<input class="acf-image-value" type="hidden" name="<?php echo $field['name']; ?>" value="<?php echo $field['value']; ?>" />
	<div class="has-image">
		<div class="hover">
			<ul class="bl">
				<li><a class="acf-button-delete ir" href="#"><?php _e("Remove",'acf'); ?></a></li>
				<li><a class="acf-button-edit ir" href="#"><?php _e("Edit",'acf'); ?></a></li>
			</ul>
		</div>
		<img class="acf-image-image" src="<?php echo $o['url']; ?>" alt=""/>
	</div>
	<div class="no-image">
		<p><?php _e('No image selected','acf'); ?> <input type="button" class="button add-image" value="<?php _e('Add Image','acf'); ?>" />
	</div>
</div>
		<?php
	}
149546
public function renderField(Field $field, $render_kw = [])
    {
        $other_kw = property_exists($field, 'render_kw') ? $field->render_kw : null;
        if (!is_null($other_kw)) {
            $render_kw = array_merge($other_kw, $render_kw);
        }
        $widget = $field->widget;

        return $widget($field, $render_kw);
    }
748848
protected function markup(array $field)
    {
        $attributes = $field['attributes'];
        $attributes = $this->addAttribute($attributes, 'id', $field['id']);
        $attributes = $this->addAttribute($attributes, 'name', $field['name']);
        $output = '';
        $output .= $this->getWrapper('markup', $attributes);
        $output .= $field['value'];
        $output .= $this->getWrapperEnd('markup');
        return $output;
    }
1071109
protected function renderElement($field)
    {
        $type = $field['type'];
        switch ($type) {
            case 'textarea':
            case 'markup':
            case 'select':
            case 'radio':
            case 'checkbox':
                return $this->$type($field);
            default:
                return $this->input($field);
        }
    }
1116240
def render_field(self, field, data):
        """"""
        from trionyx.renderer import renderer

        if 'value' in field:
            value = field['value']
        elif isinstance(data, object) and hasattr(data, field['field']):
            value = getattr(data, field['field'])
            if 'renderer' not in field:
                value = renderer.render_field(data, field['field'], **field)
        elif isinstance(data, dict) and field['field'] in data:
            value = data.get(field['field'])
        elif isinstance(data, list) and field['__index__'] < len(data):
            value = data[field['__index__']]
        else:
            return ''

        options = {key: value for key, value in field.items() if key not in ['value', 'data_object']}
        if 'renderer' in field:
            value = field['renderer'](value, data_object=data, **options)
        else:
            value = renderer.render_value(value, data_object=data, **options)

        return field['format'].format(value)
1065164
public function render( $field, $escaped_value, $object_id, $object_type, $field_type ) {
		self::setup_scripts();
		$this->field = $field;
		$this->do_type_label = false;

		if ( ! is_admin() ) {
			// Will need custom styling!
			// @todo add styles for front-end
			require_once( ABSPATH . 'wp-admin/includes/template.php' );
			do_action( 'cmb2_attached_posts_field_add_find_posts_div' );
		} else {
			// markup needed for modal
			add_action( 'admin_footer', 'find_posts_div' );
		}

		$query_args = (array) $this->field->options( 'query_args' );
		$query_users = $this->field->options( 'query_users' );

		if ( ! $query_users ) {

			// Setup our args
			$args = wp_parse_args( $query_args, array(
				'post_type'      => 'post',
				'posts_per_page' => 100,
			) );

			if ( isset( $_POST['post'] ) ) {
				$args['post__not_in'] = array( absint( $_POST['post'] ) );
			}

			// loop through post types to get labels for all
			$post_type_labels = array();
			foreach ( (array) $args['post_type'] as $post_type ) {
				// Get post type object for attached post type
				$post_type_obj = get_post_type_object( $post_type );

				// continue if we don't have a label for the post type
				if ( ! $post_type_obj || ! isset( $post_type_obj->labels->name ) ) {
					continue;
				}

				if ( is_post_type_hierarchical( $post_type_obj ) ) {
					$args['orderby'] = isset( $args['orderby'] ) ? $args['orderby'] : 'name';
					$args['order']   = isset( $args['order'] ) ? $args['order'] : 'ASC';
				}

				$post_type_labels[] = $post_type_obj->labels->name;
			}

			$this->do_type_label = count( $post_type_labels ) > 1;

			$post_type_labels = implode( '/', $post_type_labels );

		} else {
			// Setup our args
			$args = wp_parse_args( $query_args, array(
				'number' => 100,
			) );
			$post_type_labels = $field_type->_text( 'users_text', esc_html__( 'Users' ) );
		}

		$filter_boxes = '';
		// Check 'filter' setting
		if ( $this->field->options( 'filter_boxes' ) ) {
			$filter_boxes = '<div class="search-wrap"><input type="text" placeholder="' . sprintf( __( 'Filter %s', 'cmb' ), $post_type_labels ) . '" class="regular-text search" name="%s" /></div>';
		}

		// Check to see if we have any meta values saved yet
		$attached = (array) $escaped_value;

		$objects = $this->get_all_objects( $args, $attached );

		// If there are no posts found, just stop
		if ( empty( $objects ) ) {
			return;
		}

		// Wrap our lists
		echo '<div class="attached-posts-wrap widefat" data-fieldname="'. $field_type->_name() .'">';

		// Open our retrieved, or found posts, list
		echo '<div class="retrieved-wrap column-wrap">';
		echo '<h4 class="attached-posts-section">' . sprintf( __( 'Available %s', 'cmb' ), $post_type_labels ) . '</h4>';

		// Set .has_thumbnail
		$has_thumbnail = $this->field->options( 'show_thumbnails' ) ? ' has-thumbnails' : '';
		$hide_selected = $this->field->options( 'hide_selected' ) ? ' hide-selected' : '';

		if ( $filter_boxes ) {
			printf( $filter_boxes, 'available-search' );
		}

		echo '<ul class="retrieved connected' . $has_thumbnail . $hide_selected . '">';

		// Loop through our posts as list items
		$this->display_retrieved( $objects, $attached );

		// Close our retrieved, or found, posts
		echo '</ul><!-- .retrieved -->';

		// @todo make User search work.
		if ( ! $query_users ) {
			$findtxt = $field_type->_text( 'find_text', __( 'Search' ) );

			$js_data = json_encode( array(
				'queryUsers' => $query_users,
				'types'      => $query_users ? 'user' : (array) $args['post_type'],
				'cmbId'      => $this->field->cmb_id,
				'errortxt'   => esc_attr( $field_type->_text( 'error_text', __( 'An error has occurred. Please reload the page and try again.' ) ) ),
				'findtxt'    => esc_attr( $field_type->_text( 'find_text', __( 'Find Posts or Pages' ) ) ),
				'groupId'    => $this->field->group ? $this->field->group->id() : false,
				'fieldId'    => $this->field->_id(),
				'exclude'    => isset( $args['post__not_in'] ) ? $args['post__not_in'] : array(),
			) );

			echo '<p><button type="button" class="button cmb2-attached-posts-search-button" data-search=\''. $js_data .'\'>'. $findtxt .' <span title="'. esc_attr( $findtxt ) .'" class="dashicons dashicons-search"></span></button></p>';
		}

		echo '</div><!-- .retrieved-wrap -->';

		// Open our attached posts list
		echo '<div class="attached-wrap column-wrap">';
		echo '<h4 class="attached-posts-section">' . sprintf( __( 'Attached %s', 'cmb' ), $post_type_labels ) . '</h4>';

		if ( $filter_boxes ) {
			printf( $filter_boxes, 'attached-search' );
		}

		echo '<ul class="attached connected', $has_thumbnail ,'">';

		// If we have any ids saved already, display them
		$ids = $this->display_attached( $attached );

		// Close up shop
		echo '</ul><!-- #attached -->';
		echo '</div><!-- .attached-wrap -->';

		echo $field_type->input( array(
			'type'  => 'hidden',
			'class' => 'attached-posts-ids',
			'value' => ! empty( $ids ) ? implode( ',', $ids ) : '',
			'desc'  => '',
		) );

		echo '</div><!-- .attached-posts-wrap -->';

		// Display our description if one exists
		$field_type->_desc( true, true );
	}
479096
function create_field( $field )
	{
		// html
		echo '<ul class="acf-checkbox-list ' . $field['class'] . '">';
			echo '<input type="hidden" name="'.$field['name'].'" value="0" />';
			$selected = ($field['value'] == 1) ? 'checked="yes"' : '';
			echo '<li><label><input id="' . $field['id'] . '-1"  type="checkbox" name="'.$field['name'].'" value="1" ' . $selected . ' />' . $field['message'] . '</label></li>';
		
		echo '</ul>';
	}