Fill a metabox with custom fields
359677
function mf_metabox_content( $post, $metabox ) {
    global $mf_domain, $mf_post_values;

    //Getting the custom fields for this metabox
    $custom_fields = $this->get_custom_fields_by_group($metabox['args']['group_info']['id']);
    $group_id = $metabox['args']['group_info']['id'];
    //default markup
    ?>
    <div class="mf-group-wrapper group-<?php print $group_id;?>" id="mf_group-<?php print $group_id; ?>" >
      <!-- grupos se puede repetir -->
      <?php
        $extraclass = "";
        if( $metabox['args']['group_info']['duplicated'] ) {
          $extraclass = "mf_duplicate_group";
          $repeated_groups = $this->mf_get_duplicated_groups( $post->ID, $group_id );
        } else {
          $repeated_groups = 1;
        }

        for( $group_index = 1; $group_index <= $repeated_groups; $group_index++ ){
          $only = ($repeated_groups == 1)? TRUE : FALSE;
          $this->mf_draw_group($metabox,$extraclass,$group_index,$custom_fields,$mf_post_values,$only);
        }
        printf('<input value="%d" id="mf_group_counter_%d" style="display:none" >',$repeated_groups,$group_id);
      ?>
      <!-- fin del grupo -->
    </div>
  <?php
  }
1063458
def get_meta_fields(self, fields, kwargs={}):
        '''
        
        '''
        fields = to_list(fields)
        meta = self.get_meta()
        return {field: meta.get(field) for field in fields}
676455
def build_dynamic_field(self, group, field_meta):
        
        schema = field_meta['schema']

        # set up some defaults for form fields
        fieldtype = 'text'
        fkwargs = {
            'label': field_meta['name'],
            'required': field_meta['required'],
        }
        # override defaults based on field configuration
        if (schema['type'] in ['securitylevel', 'priority']
                or schema.get('custom') == JIRA_CUSTOM_FIELD_TYPES['select']):
            fieldtype = 'select'
            fkwargs['choices'] = self.make_choices(field_meta.get('allowedValues'))
        elif field_meta.get('autoCompleteUrl') and \
                (schema.get('items') == 'user' or schema['type'] == 'user'):
            fieldtype = 'select'
            sentry_url = '/api/0/issues/%s/plugins/%s/autocomplete' % (group.id, self.slug)
            fkwargs['url'] = '%s?jira_url=%s' % (
                sentry_url, quote_plus(field_meta['autoCompleteUrl']),
            )
            fkwargs['has_autocomplete'] = True
            fkwargs['placeholder'] = 'Start typing to search for a user'
        elif schema['type'] in ['timetracking']:
            # TODO: Implement timetracking (currently unsupported alltogether)
            return None
        elif schema.get('items') in ['worklog', 'attachment']:
            # TODO: Implement worklogs and attachments someday
            return None
        elif schema['type'] == 'array' and schema['items'] != 'string':
            fieldtype = 'select'
            fkwargs.update(
                {
                    'multiple': True,
                    'choices': self.make_choices(field_meta.get('allowedValues')),
                    'default': []
                }
            )

        # break this out, since multiple field types could additionally
        # be configured to use a custom property instead of a default.
        if schema.get('custom'):
            if schema['custom'] == JIRA_CUSTOM_FIELD_TYPES['textarea']:
                fieldtype = 'textarea'

        fkwargs['type'] = fieldtype
        return fkwargs
726890
private function AddMetaTitlePlacementField()
    {
        $name = 'MetaTitlePlacement';
        $value = $this->archive->GetMetaTitlePlacement() ?: MetaPlacement::Prepend()->Value();
        $this->AddMetaPlacementSelect($name, $value);
    }
586732
private void fillFields() {

        String folderName = getModuleFolder(m_module.getName());
        if (folderName != null) {
            if (CmsStringUtil.isEmptyOrWhitespaceOnly(m_parentFormatter.getValue())) {
                m_parentFormatter.setValue(folderName + FORMATTER);
            }
            if (CmsStringUtil.isEmptyOrWhitespaceOnly(m_parentSchema.getValue())) {
                m_parentSchema.setValue(folderName + SCHEMA);
            }
        }
        if (m_cms.existsResource(folderName + CmsEditModuleForm.CONFIG_FILE)) {
            m_config.setValue(folderName + CmsEditModuleForm.CONFIG_FILE);
        }
        m_parentFormatter.removeAllValidators();
        m_parentSchema.removeAllValidators();
        m_config.removeAllValidators();
        m_config.addValidator(new ResourceValidator());
        m_bundle.addValidator(new BundleValidator());
        m_parentFormatter.addValidator(new ResourceValidator());
        m_parentSchema.addValidator(new ResourceValidator());
        CmsResource bundle = getMessageBundle();
        if (bundle != null) {
            m_bundle.setValue(bundle.getRootPath());

        }
    }
350337
function meta_box_input( $post, $args )
	{
		// extract $args
		extract( $args );
		
		
		// classes
		$class = 'acf_postbox ' . $args['field_group']['options']['layout'];
		$toggle_class = 'acf_postbox-toggle';
		
		
		if( ! $args['show'] )
		{
			$class .= ' acf-hidden';
			$toggle_class .= ' acf-hidden';
		}
		
		
		// HTML
		if( $args['show'] )
		{
			$fields = apply_filters('acf/field_group/get_fields', array(), $args['field_group']['id']);
	
			do_action('acf/create_fields', $fields, $args['post_id']);
		}
		else
		{
			echo '<div class="acf-replace-with-fields"><div class="acf-loading"></div></div>';
		}
		
		
		// nonce
		echo '<div style="display:none">';
			echo '<input type="hidden" name="acf_nonce" value="' . wp_create_nonce( 'input' ) . '" />';
			?>
<script type="text/javascript">
(function($) {
	
	$('#<?php echo $id; ?>').addClass('<?php echo $class; ?>').removeClass('hide-if-js');
	$('#adv-settings label[for="<?php echo $id; ?>-hide"]').addClass('<?php echo $toggle_class; ?>');
	
})(jQuery);	
</script>
			<?php
		echo '</div>';
	}
1220523
function mf_metabox_template () {
    global $post;

    if ( 0 != count( get_page_templates() ) ) {

      $template = get_post_meta($post->ID, '_wp_mf_page_template', TRUE);
      $template =  ($template != '') ? $template : false;
    ?>
      <label class="screen-reader-text" for="page_template"><?php _e('Page Template') ?></label><select name="page_template" id="page_template">
      <option value='default'><?php _e('Default Template'); ?></option>
      <?php page_template_dropdown($template); ?>
      </select>
    <?php
    }
  }
1299036
function BindedField() {
    var object = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : mandatory("object");
    var property = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : mandatory("property");
    var parent = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : null;
    var fieldType = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : "input";
    var allowedValues = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : null;
    var hierarchy = arguments.length > 5 && arguments[5] !== undefined ? arguments[5] : null;

    _classCallCheck(this, BindedField);

    // constant
    var _this4 = _possibleConstructorReturn(this, (BindedField.__proto__ || Object.getPrototypeOf(BindedField)).call(this, object, property, hierarchy));

    _this4.VALID_FIELD_TYPE = ["input", "selector", "slider"];

    // field
    _this4.field = null;
    _this4.fieldType = fieldType;
    _this4.fieldHTML = null;
    _this4.allowedValues = allowedValues;
    _this4.tempClass = "binded-" + (typeof object === "undefined" ? "undefined" : _typeof(object)) + property;

    // parent
    _this4.parent = parent;

    // build the field html
    switch (_this4.fieldType) {
      case "input":
        _this4.fieldHTML = "<fieldset class=\"form-group\">" + "<label>" + property + "</label>" + "<input type=\"text\" class=\"form-control " + _this4.tempClass + "\" data-binded=\"" + property + "\">" + "</fieldset>";
        break;
      case "selector":
        if (!allowedValues) {
          throw new Error("fieldType selector needs at least one allowedValues");
        }

        _this4.fieldHTML = "<fieldset class=\"form-group\">" + "<label>" + property + "</label>" + "<select class=\"form-control " + _this4.tempClass + "\" data-binded=\"" + property + "\">";

        for (var i = 0; i < _this4.allowedValues.length; i++) {
          _this4.fieldHTML = _this4.fieldHTML + "<option value=\"" + _this4.allowedValues[i] + "\">" + _this4.allowedValues[i] + "</option>";
        }
        _this4.fieldHTML = _this4.fieldHTML + "</select></fieldset>";
        break;
      case "slider":
        break;
      default:
        throw new Error("fieldType is invalid : input, selector and slider are the only valid type for now");
    }

    if (parent) {
      _this4.placeInParent();
    }
    return _this4;
  }
401932
private function loadCustomTypes()
    {
        $customFields = (array) $this->getConfig('custom_fields');

        if (!empty($customFields)) {
            foreach ($customFields as $fieldName => $fieldClass) {
                $this->addCustomField($fieldName, $fieldClass);
            }
        }
    }
153186
public function add_metaboxes() {
		$methos = $this->getMethods("/^metabox_/");
		sort($methos); //Se ordenas los metodos por prioridad
		if ($methos) {
			foreach ($methos as $metabox) {
                call_user_func(array($this, $metabox));
			}
		}
	}
639714
def add_custom_fields(cls, *args, **kw):
        
        for factory in config.custom_field_factories:
            for field in factory():
                setattr(cls, field.name, field)
1342413
def initialize_fields(self):
        
        for field in dir(self):
            obj = getattr(self, field)
            if isinstance(obj, Field):
                self._meta.fields[field] = obj
820602
def customize_form_field(self, name, field):
        
        if isinstance(field, forms.fields.DateField) and isinstance(field.widget, forms.widgets.DateInput):
            field.widget = widgets.DatePickerWidget()
            field.input_formats = [field.widget.input_format[1]] + list(field.input_formats)

        if isinstance(field, forms.fields.ImageField) and isinstance(field.widget, forms.widgets.ClearableFileInput):
            field.widget = widgets.ImageThumbnailWidget()

        return field
350026
function fill(form_id, data) {
        this._checkInit(form_id);
        for (var input_name in data) {
            if (this._collection[form_id].has(input_name)) {
                this.set(form_id, input_name, data[input_name]);
            }
        }
    }
462203
private function AddMetaDescriptionPlacementField()
    {
        $name = 'MetaDescriptionPlacement';
        $value = $this->archive->GetMetaDescriptionPlacement() ?: MetaPlacement::Prepend()->Value();
        $this->AddMetaPlacementSelect($name, $value);
    }
905853
public function register_meta_box() {
		$flg = false;
		foreach ( $this->namespaces as $ns => $dir ) {
			$sub_base = $dir . '/' . $ns . '/MetaBoxes';
			if ( is_dir( $sub_base ) ) {
				// Enqueue script flag
				// Load all meta boxes
				foreach ( scandir( $sub_base ) as $file ) {
					if ( ! preg_match( '/\.php$/u', $file ) ) {
						$class_name = $ns . '\\MetaBoxes\\' . str_replace( '.php', '', $file );
						if ( class_exists( $class_name ) && $this->is_sub_class_of( $class_name, EditMetaBox::class ) ) {
							$class_name::get_instance();
							$flg = true;
						}
					}
				}
			}
		}
		if ( $flg ) {
			add_action( 'admin_enqueue_scripts', [ $this, 'admin_enqueue_scripts' ] );
		}
	}
545024
def _set_meta(self):
        
        # we want to set meta-fields that are shared by ALL params in the PS
        for field in _meta_fields_twig:
            keys_for_this_field = set([getattr(p, field)
                                       for p in self.to_list()
                                       if getattr(p, field) is not None])
            if len(keys_for_this_field)==1:
                setattr(self, '_'+field, list(keys_for_this_field)[0])
            else:
                setattr(self, '_'+field, None)