Output the HTML for the dynamic image management.

@since 1.0.0

@param  array    $form_fields The current output.
@param \WP_Post $post The current attachment.
@return mixed
773617
public function add_intermediate_mgmt_fields($form_fields, $post = null)
    {
        $current_screen = \get_current_screen();

        if (isset($current_screen->base) && $current_screen->base === 'post') {
            return $form_fields;
        }

        // Only display for admin level users, and only if an image.
        if (\strpos(\wp_get_referer(), 'upload.php') !== false
            && \wp_attachment_is_image($post->ID)
            && \current_user_can('manage_options')
        ) {
            $meta = wp_get_attachment_metadata($post->ID);

            $public_sizes = \array_diff(get_intermediate_image_sizes(), Size_Manager::get_dynamic_sizes());

            $output = '<hr><p><strong>Generated sizes:</strong></p>';

            if (!empty($meta['sizes'])) {
                $output .= '<table class="widefat fixed striped media">
                    <thead>
                        <tr style="display:table-row;">
                            <td class="manage-column column-cb check-column">
                                <input id="delete-intermediate-all" type="checkbox">
                            </td>
                            <th>Name</th>
                            <th>Width</th>
                        </tr>
                    </thead>
                    <tbody>';

                foreach ($meta['sizes'] as $key => $value) {
                    if (\in_array($key, $public_sizes)) {
                        continue;
                    }

                    $output .= '<tr style="display:table-row;"><th class="check-column">';
                    $output .= '<input type="checkbox" name="[delete-intermediate][]" value="'.$key.'">';
                    $output .= '</th><td>'.$key.'</td><td>'. $value['width'] . 'x' . $value['height'].'</td></tr>';
                }

                $output .= '</tbody></table>
	                <button type="button" style="margin-top: 5px;" class="button-link delete-intermediate-button">Delete selected sizes</button>';
            }

            $form_fields['generated_sizes'] = [
                'input' => 'html',
                'tr' => $output,
            ];
        }

        return $form_fields;
    }
926108
public function hiddenFormFields()
    {
        $fields = $this->getParameter('fields');

        if (empty($fields))
            return '';

        $html_array = ArrayUtils::htmlArrayFlatten($fields);

        foreach ($html_array as $name => $value) {
            $name  = htmlentities($name, ENT_QUOTES);
            $value = htmlentities($value, ENT_QUOTES);

            $output[] = "<input type=\"hidden\" name=\"$name\" value=\"$value\" />";
        }

        return join("\n", $output);
    }
950792
public function renderMetaBox($post, $post_config, $return = false)
    {
        $config = $this->getMetaBoxConfig($post_config['args']);
        if (!Arr::iterable($config['fields'])) {
            return false;
        }

        $this->load($post);

        $out = array();
        $out[] = '<table>';
        foreach ($config['fields'] as $name => $field) {
            // Hack to know if we're editing an existing post
            $is_existing_post = (
                is_array($_SERVER)
                && array_key_exists('REQUEST_URI', $_SERVER)
                && preg_match('/post=([\d]{1,})/', $_SERVER['REQUEST_URI'])
            );
            
            $field['type'] = (array_key_exists('type', $field)) ? $field['type'] : 'text';

            if (array_key_exists($name, $this->_info)) {
                $field['value'] = $this->_info[$name];
            } elseif ($is_existing_post && $field['type'] !== 'html') {
                $field['value'] = null;
            }

            $default = null;
            if (array_key_exists('default', $field)) {
                if ($field['type'] === 'select') {
                    $default = $field['options'][$field['default']];
                } elseif ($field['type'] === 'image') {
                    $default = '<br>'.Html::image($field['default'], null, array('style'=>'max-width:100px;'));
                } else {
                    $default = nl2br($field['default']);
                }
            }
            $tr_class = $name;
            if ($field['type'] === 'hidden') {
                $tr_class .= ' hidden';
            }
            $out[] = sprintf(
                '<tr%s><td>%s</td><td>%s%s%s</td></tr>',
                Html::attribs(array('class'=>$tr_class)),
                $this->getRenderLabel($name),
                $this->getRenderMetaBoxField($name, $field),
                (array_key_exists('description', $field)) ? Html::p($field['description'], array('class'=>'description')) : null,
                (!is_null($default)) ? sprintf('<p class="description">Default: %s</p>', $default) : null
            );
        }
        $out[] = '</table>';

        $html = join("\n", $out);
        if ($return) {
            return $html;
        }
        echo $html;
    }
845614
protected function renderAdminForm(
        FormInterface $form,
        array $params = array(),
        $response = null,
        $template = self::TEMPLATE
    ){
        if (is_null($response)) {
            $code = Response::HTTP_OK;
            if ($form->isSubmitted() && !$form->isValid()) {
                $code = Response::HTTP_UNPROCESSABLE_ENTITY;
            }
            $response = new Response('', $code, array('Content-type' => 'text/html; charset=utf-8'));
        }

        $params = array_merge($params, array('form' => $form->createView()));

        return $this->render($template, $params, $response);
    }
1109958
protected function renderInputForm() {
        $arrTableBody = [];
        
        foreach ($this->config['attributes'] as $attribute) {
            $label = isset($attribute['label'])?$attribute['label']:"";
            $fieldName = isset($attribute['name'])?$attribute['name']:"";
            $value = isset($attribute['default'])?$attribute['default']:"";
            $arrTableBody[] = [
                H::label($label, $fieldName),
                H::input($fieldName, "input", $value),
            ];
        }
        
        $content = H::renderTable([], $arrTableBody)
                 . H::button("Generate Code");
        $output = H::form($_SERVER['REQUEST_URI'], $content);
        $headers = "";
        if (defined('css_headers')) {
            foreach(css_headers as $css) {
                $headers .= H::link("", ["href" => $css, "rel" => "stylesheet"]);
            }
        }
        return H::htmlDocument("Codemonkey", $headers, $output);
    }
1299553
protected function get_field( \WP_Post $post ){
        $field = parent::get_field($post);
        $automatic = $this->original_callback ? ' original' : '';
        $geocder = $this->show_geocoder ? $this->geocoder() : '';
        return <<<HTML
            {$field}
            <div id="{$this->name}-map" class="wpametu-map{$automatic}"></div>
            {$geocder}
HTML;

    }
1107093
public function renderUntil($field_name, $showFormEnd = true, $showFields = true)
    {
        $fields = $this->getUnrenderedFields();

        $i = 1;
        foreach ($fields as $key => $value) {
            if ($value->getRealName() == $field_name) {
                break;
            }
            $i++;
        }

        $fields = array_slice($fields, 0, $i, true);

        return $this->render([], $fields, false, $showFields, $showFormEnd);
    }
578649
public function __toHtml($submitted = false, $blnSimpleLayout = false, $blnLabel = true, $blnDisplayError = true, $intCount = 0)
    {
        // *** Conditional meta should be set before all other meta. Otherwise the set meta is being reset.
        $this->setConditionalMeta();

        // Do nothing if multifield has no child fields.
        if ($this->__fields->count() == 0) {
            return "";
        }

        $blnError = false;
        $arrError = array();

        $blnRequired = false;

        /* @var $field Element */
        foreach ($this->__fields as $field) {
            $objValidator = $field->getValidator();
            if (is_object($objValidator)) {
                // *** Check if this multifield should have required styling.
                if ($objValidator->getRequired()) {
                    $blnRequired = true;
                }

                if ($submitted && ! $objValidator->validate($intCount) && $blnDisplayError) {
                    $blnError = true;

                    $strError = $field->getValidator()->getError($intCount);
                    if (! in_array($strError, $arrError)) {
                        $arrError[] = $strError;
                    }
                }
            }
        }

        // *** We asume that all dynamic fields greater than 0 are never required.
        if ($blnRequired && $intCount == 0) {
            $this->setMeta("class", "vf__required");
        } else {
            $this->setMeta("class", "vf__optional");
        }

        // *** Set custom meta.
        if ($blnError) {
            $this->setMeta("class", "vf__error");
        }

        $this->setMeta("class", "vf__multifield");

        if ($this->isRemovable()) {
            $this->setMeta("class", "vf__removable");
        }

        //*** Add data-dynamic="original" or data-dynamic="clone" attributes to dynamic fields
        if ($this->isDynamic()) {
            if ($intCount === 0) {
                // This is the first, original element. Make sure to define that.
                $this->setMeta('data-dynamic', 'original', true);
            } else {
                $this->setMeta('data-dynamic', 'clone', true);
                $this->setMeta("class", "vf__clone");
            }
        }

        $strId = ($intCount == 0) ? $this->getId() : $this->getId() . "_{$intCount}";
        $strOutput = "<div{$this->__getMetaString()} id=\"{$strId}\">\n";

        if ($blnError) {
            $strOutput .= "<p class=\"vf__error\">" . implode("</p><p class=\"vf__error\">", $arrError) . "</p>";
        }

        $strLabel = (! empty($this->__requiredstyle) && $blnRequired) ? sprintf($this->__requiredstyle, $this->__label) : $this->__label;
        if (! empty($this->__label)) {
            $strOutput .= "<label for=\"{$strId}\"{$this->__getLabelMetaString()}>{$strLabel}</label>\n";
        }

        foreach ($this->__fields as $field) {
            // Skip the hidden dynamic counter fields.
            if (($intCount > 0) && (get_class($field) == "ValidFormBuilder\\Hidden") && $field->isDynamicCounter()) {
                continue;
            }

            $strOutput .= $field->__toHtml($submitted, true, $blnLabel, $blnDisplayError, $intCount);
        }

        if (! empty($this->__tip)) {
            $strOutput .= "<small class=\"vf__tip\"{$this->__getTipMetaString()}>{$this->__tip}</small>\n";
        }

        if ($this->isRemovable()) {
            $this->setMeta("dynamicRemoveLabelClass", "vf__removeLabel");

            $strOutput .= $this->getRemoveLabelHtml();
        }

        $strOutput .= "</div>\n";

        if ($intCount == $this->getDynamicCount()) {
            $strOutput .= $this->getDynamicHtml();
        }

        return $strOutput;
    }
848984
function toFormMarkup($form_tag_attrs=null)
    {
        return $this->fields->toFormMarkup($this->request->return_to,
                                           $form_tag_attrs);
    }
1012057
public function _display_render( $field, $val ) {
		$return = '';
		$posts = array();

		if ( ! empty( $val ) ) {
			foreach ( (array) $val as $id ) {
				$title = get_the_title( $id );
				if ( $title ) {
					$edit_link = get_edit_post_link( $id );
					$posts[ $id ] = compact( 'title', 'edit_link' );
				}
			}
		}

		if ( ! empty( $posts ) ) {

			$return .= '<ol>';
			foreach ( (array) $posts as $id => $post ) {
				$return .= sprintf(
					'<li id="attached-%d"><a href="%s">%s</a></li>',
					$id,
					$post['edit_link'],
					$post['title']
				);
			}
			$return .= '</ol>';

		} else {
			$return .= '&mdash;';
		}

		return $return;
	}
1123435
function update_field( $field, $post_id )
	{
		// sanitize field name
		// - http://support.advancedcustomfields.com/discussion/5262/sanitize_title-on-field-name
		// - issue with camel case! Replaced with JS
		//$field['name'] = sanitize_title( $field['name'] );
		
		
		// filters
		$field = apply_filters('acf/update_field/type=' . $field['type'], $field, $post_id ); // new filter
		
		
		// clear cache
		wp_cache_delete( 'load_field/key=' . $field['key'], 'acf' );
	
		
		// save
		update_post_meta( $post_id, $field['key'], $field );
	}
555626
private function get_modules_content( \WP_Post $post ) : string {
		$flexible_content = $this->_flexible_content[ $post->ID ] ?? null;

		if ( empty( $flexible_content ) ) {
			$layouts = $this->get_current_post_layouts( $post );

			foreach ( $layouts as $layout ) {

				if ( ! isset( $layout['acf_fc_layout'] ) || empty( $layout['acf_fc_layout'] ) ) {
					continue;
				}

				ob_start();
				$this->render_module_template( $layout['acf_fc_layout'], $layout );
				$flexible_content .= ob_get_clean();
			}

			/*
			 * Store the flexible content to reuse it if `the_content` is
			 * runned more than once.
			 */
			$this->_flexible_content[ $post->ID ] = $flexible_content;
		}

		return (string) $flexible_content;
	}
1165913
private function hasTemplateForPost(\WP_Post $post): bool
    {
        $postTemplate = get_post_meta($post->ID, '_wp_page_template', true);

        $templates = isset($this->template[$post->post_type]) ? $this->template[$post->post_type] : [];

        if (empty($templates)) {
            // No templates exist for the current post type so we let
            // pass through either in order to display the metabox.
            return true;
        }

        return in_array($postTemplate, $templates, true);
    }
564274
public function output() {
		if ( ! $form = $this->manager->get_form() ) {
			_doing_it_wrong( __FUNCTION__, 'Cannot output the section until the form is created', null );
			return;
		}

		$attributes = [
			'role'        => 'tabpanel',
			'id'          => $this->uniqid(),
			'aria-hidden' => ! empty( $this->options['active'] ) ? 'false' : 'true',
		];

		echo '<section' . Utils::build_html_attributes( $attributes ) . '>'; // WPCS: XSS OK.

		foreach ( $this->fields as $field ) {
			$form->show( $field );
		}

		echo '</section>';
	}
574801
public function _wp_seo_meta_box( $post ) {
		?>
		<?php wp_nonce_field( 'wp-seo-meta-box-action', 'wp-seo-meta-box-nonce' ); ?>
		<p>
			<label for="wp-seo-meta-description">
				<b><?php esc_html_e( 'Meta description', 'inc2734-wp-seo' ); ?></b>
			</label><br />
			<input
				type="text"
				name="wp-seo-meta-description"
				class="widefat"
				id="wp-seo-meta-description"
				value="<?php echo esc_attr( get_post_meta( $post->ID, 'wp-seo-meta-description', true ) ); ?>"
			/>
		</p>
		<p>
			<b><?php esc_html_e( 'Meta robots', 'inc2734-wp-seo' ); ?></b><br />
			<?php
			$robots = (array) get_post_meta( $post->ID, 'wp-seo-meta-robots', true );
			$robots_choices = [
				'noindex',
				'nofollow',
			]
			?>
			<?php foreach ( $robots_choices as $robot ) : ?>
				<label for="wp-seo-meta-robots-<?php echo esc_attr( $robot ); ?>" style="margin-right: 1em;">
					<input
						type="checkbox"
						name="wp-seo-meta-robots[]"
						id="wp-seo-meta-robots-<?php echo esc_attr( $robot ); ?>"
						value="<?php echo esc_attr( $robot ); ?>"
						<?php checked( in_array( $robot, $robots ) ); ?>
					/>
					<?php echo esc_html( $robot ); ?>
				</label>
			<?php endforeach; ?>
		</p>
		<?php
	}
327053
function get_result( $post, $field, $the_post, $options = array() ) {
		
		// right aligned info
		$title = '<span class="relationship-item-info">';
			
			if( in_array('post_type', $field['result_elements']) ) {
				
				$post_type_object = get_post_type_object( $post->post_type );
				$title .= $post_type_object->labels->singular_name;
				
			}
			
			
			// WPML
			if( !empty($options['lang']) ) {
				
				$title .= ' (' . $options['lang'] . ')';
				
			} elseif( defined('ICL_LANGUAGE_CODE') ) {
				
				$title .= ' (' . ICL_LANGUAGE_CODE . ')';
				
			}
			
		$title .= '</span>';
		
		
		// featured_image
		if( in_array('featured_image', $field['result_elements']) ) {
			
			$image = '';
			
			if( $post->post_type == 'attachment' ) {
				
				$image = wp_get_attachment_image( $post->ID, array(21, 21) );
				
			} else {
				
				$image = get_the_post_thumbnail( $post->ID, array(21, 21) );
				
			}
			
			$title .= '<div class="result-thumbnail">' . $image . '</div>';
			
		}
		
		
		// title
		$post_title = get_the_title( $post->ID );
		
		
		// empty
		if( $post_title === '' ) {
			
			$post_title = __('(no title)', 'acf');
			
		}
		
		
		$title .= $post_title;
		
		
		// status
		if( get_post_status( $post->ID ) != "publish" ) {
			
			$title .= ' (' . get_post_status( $post->ID ) . ')';
			
		}
			
		
		// filters
		$title = apply_filters('acf/fields/relationship/result', $title, $post, $field, $the_post);
		$title = apply_filters('acf/fields/relationship/result/name=' . $field['_name'] , $title, $post, $field, $the_post);
		$title = apply_filters('acf/fields/relationship/result/key=' . $field['key'], $title, $post, $field, $the_post);
		
		
		// return
		return $title;
		
	}
251509
public function display($post_type, $post)
    {
        if (! is_null($this->capability) && ! current_user_can($this->capability)) {
            return;
        }

        if (! $this->hasTemplateForPost($post)) {
            return;
        }

        $this->filter->add('admin_body_class', function ($classes) {
            if (false !== strrpos($classes, 'themosis')) {
                return $classes;
            }

            $classes.= ' themosis';

            return $classes;
        });

        add_meta_box(
            $this->getId(),
            $this->getTitle(),
            [$this, 'render'],
            $this->getScreen(),
            $this->getContext(),
            $this->getPriority(),
            $this->getArguments()
        );
    }