Finds a media asset by name.

@param string $field_name
Field name.

@return array
Returns media entities.
492322
public function populateMediaField($field_name) {
    $item = $this->item;
    $assets = [];
    if (!empty($item[$field_name])) {
      $data = $this->loadDataArray('media_image');

      foreach ($item[$field_name] as $k => $value) {
        if (!empty($data[$value])) {
          $name = $data[$value]['name'];
          $entities = $this->loadEntitiesByProperties('media', ['name' => $name]);

          foreach ($entities as $entity) {
            $assets[] = ['target_id' => $entity->id()];
          }
        }
      }
      return $assets;
    }
  }
217072
protected function _getField($name)
    {
        return ( array_key_exists($name, $this->_data) ) ? $this->_data[$name] : false;
    }
25669
public function get($name)
    {
        // For fields that are stored as arrays, like 'video'
        if (strpos($name, '.') > 0) {
            list($name, $attr) = explode('.', $name);
            if (!empty($attr) && isset($this->values[$name][$attr])) {
                return $this->values[$name][$attr];
            }
        }

        if (isset($this->values[$name])) {
            return $this->values[$name];
        }

        return false;
    }
301681
public static function getAssetFolderName($file_name)
    {
        $file_extension = strtolower(substr(strrchr($file_name,"."), 1));
        if (preg_match('/jpg|jpeg|gif|png|ico/', $file_extension)) {
            return 'img';
        }
        if ($file_extension === 'js') {
            return 'js';
        }
        if ($file_extension === 'css') {
            return 'css';
        }
        if ($file_extension === 'pdf') {
            return 'pdf';
        }
        return false;
    }
265099
public function getField(string $name)
    {
        $name = trim($name);
        if (!$this->isFieldSet($name)) {
            return null;
        }

        $field_key = array_search($name, $this->keys);
        return $this->method[$field_key] ?? $_FILES[$field_key];
    }
981573
public function getMediaFromCustomFields($customFields, ...$slugs)
    {
        $mediaIDs = [];
        foreach($customFields as $fields){
            foreach($fields as $field => $value){
                if(in_array($field, $slugs)) {
                    if(!is_array($value)) {
                        $mediaIDs[] = $value;
                    }else{
                        foreach($value as $subValue){
                            $mediaIDs[] = $subValue;
                        }
                    }
                }
            }
        }

        $media = Media::whereIn("mediaID", $mediaIDs)->get()->keyBy("mediaID")->toArray();

        $object = [];
        if(count($media)) {
            foreach ($customFields as $fields) {
                foreach($fields as $field => $value){
                    if(in_array($field, $slugs)) {
                        if($value && isset($media[$value])) {
                            $tmp = [];
                            if (!is_array($value)) {
                                $fields->$field = new Media($media[$value]);
                            } else {
                                foreach ($value as $subValue) {
                                    $tmp[] = new Media($media[$value]);
                                }
                                $fields->$field = $tmp;
                            }
                        }else{
                            $fields->$field = null;
                        }
                    }
                }
                $object[] = $fields;
            }
        }else{
            $object = $customFields;
        }

        return collect($object);
    }
766787
public static function get_theme_field( $field_name, $default = false ) {

		if ( ! empty( self::$theme ) ) {
			return self::$theme->get( $field_name );
		}

		return $default;
	}
208655
public function getNodeElements($field_name)
	{
		$node_elements = $this->findAll(
			'named',
			array('field', $this->getXpathEscaper()->escapeLiteral($field_name))
		);

		if ( empty($node_elements) ) {
			throw new FormException(
				sprintf('Form field "%s" not found', $field_name),
				FormException::TYPE_NOT_FOUND
			);
		}

		return $node_elements;
	}
81687
public function getFieldValue(string $field_name)
    {
        try {
            $value = null;
            $fields = $this->stmt->fetch(\PDO::FETCH_ASSOC);
            if (array_key_exists($field_name, $fields)) {
                $value = $fields[$field_name];
            } else {
                throw new \Exception("Field '$field_name' is not present in the current result set.\n");
            }
            return $value;
        } catch (\PDOException $e) {
            die('Error: ' . $e->getMessage());
        } catch (\Exception $e) {
            die("Error: " . $e->getMessage());
        }
    }
777106
public static function get_image_fields( $field, $attachment_id, $sub_field = false ) {
		$size = apply_filters( Filter::IMAGE, false, $field, $sub_field );

		if ( ! $size ) {
			return $attachment_id;
		}

		$src = wp_get_attachment_image_src( $attachment_id, $size );

		if ( ! $src ) {
			return $attachment_id;
		}

		return [
			'src' 		=> $src[0],
			'width'		=> $src[1],
			'height'	=> $src[2],
			'alt'		=> get_post_meta( $attachment_id, '_wp_attachment_image_alt', true ),
		];
	}
265386
public function getSourceFieldName($media_type) {
    $bundle = $this->entityTypeManager->getStorage('media_type')->load($media_type);
    if (!$bundle) {
      throw new NotFoundHttpException("Bundle $media_type does not exist");
    }

    $type_configuration = $bundle->get('source_configuration');
    if (!isset($type_configuration['source_field'])) {
      return NULL;
    }

    return $type_configuration['source_field'];
  }
511554
public function groups_get( $type, $name, $default_fields = null ) {

		static $groups_cache = array();

		if ( isset( $groups_cache[ $type . '/' . $name ] ) ) {
			return $groups_cache[ $type . '/' . $name ];
		}

		if ( 'post_type' == $type && 'attachment' == $name ) {
			$type = 'media';
			$name = 'media';
		} elseif ( 'term' == $type ) {
			$type = 'taxonomy';
		}

		do_action( 'pods_meta_groups', $type, $name );

		$pod    = array();
		$fields = array();

		$object = self::$post_types;

		if ( 'taxonomy' == $type ) {
			$object = self::$taxonomies;
		} elseif ( 'media' == $type ) {
			$object = self::$media;
		} elseif ( 'user' == $type ) {
			$object = self::$user;
		} elseif ( 'comment' == $type ) {
			$object = self::$comment;
		} elseif ( 'pod' == $type ) {
			$object = self::$advanced_content_types;
		}

		if ( ! empty( $object ) && is_array( $object ) && isset( $object[ $name ] ) ) {
			$fields = $object[ $name ]['fields'];
		} else {
			if ( empty( self::$current_pod_data ) || ! is_object( self::$current_pod_data ) || self::$current_pod_data['name'] != $name ) {
				self::$current_pod_data = pods_api()->load_pod( array( 'name' => $name ), false );
			}

			$pod = self::$current_pod_data;

			if ( ! empty( $pod ) ) {
				$fields = $pod['fields'];
			}
		}

		if ( null !== $default_fields ) {
			$fields = $default_fields;
		}

		$defaults = array(
			'name'   => 'post',
			'object' => 'post',
			'type'   => 'post_type'
		);

		$pod = array_merge( $defaults, (array) $pod );

		if ( empty( $pod['name'] ) ) {
			$pod['name'] = $pod['object'];
		} elseif ( empty( $pod['object'] ) ) {
			$pod['object'] = $pod['name'];
		}

		if ( $pod['type'] != $type ) {
			$groups_cache[ $type . '/' . $name ] = array();

			return $groups_cache[ $type . '/' . $name ];
		}

		$groups = array(
			array(
				'pod'      => $pod,
				/**
				 * Filter the title of the Pods Metabox In The Post Editor
				 *
				 * @param string  $title  The title to use, default is 'More Fields'
				 * @param obj|Pod $pod    Current Pods Object
				 * @param array   $fields Array of fields that will go in the metabox
				 * @param string  $type   The type of Pod
				 * @param string  $name   Name of the Pod
				 *
				 * @return string The title for the metabox.
				 *
				 * @since unknown
				 */
				'label'    => apply_filters( 'pods_meta_default_box_title', __( 'More Fields', 'pods' ), $pod, $fields, $type, $name ),
				'fields'   => $fields,
				'context'  => 'normal',
				'priority' => 'default'
			)
		);

		if ( isset( self::$groups[ $type ] ) && isset( self::$groups[ $type ][ $name ] ) ) {
			$groups = self::$groups[ $type ][ $name ];
		}

		/**
		 * Filter the array of field groups
		 *
		 * @param array  $groups Array of groups
		 * @param string $type   The type of Pod
		 * @param string $name   Name of the Pod
		 *
		 * @since 2.6.6
		 */
		$groups = apply_filters( 'pods_meta_groups_get', $groups, $type, $name );

		$groups_cache[ $type . '/' . $name ] = $groups;

		return $groups_cache[ $type . '/' . $name ];
	}
290926
static public function RemoveAll( $field_name_full ) {

        $field_name = self::RemoveAlias( $field_name_full );
        $field_name = self::RemoveFunctions( $field_name );
        $field_name = self::RemoveEscapes( $field_name );

        return $field_name;

      }
1321816
protected function getCaption($file_name)
    {
        if ($this->visitor instanceof Creator) {
            $toc = $this->visitor->getTableOfContents();
            $name = $toc[$file_name]->getName();
            return $name ?: $file_name;
        }

        return $file_name;
    }
233908
public function get($field_key)
	{
		if ( isset($this->fields[$field_key]) ) {
			return $this->fields[$field_key];
		}

		return null;
	}
781322
public function findField(string $name): Field
    {
        if ($this->hasField($name)) {
            return $this->fields[$this->fieldsNameIndex[$name]];
        }

        return null;
    }
660384
public function isFieldValid(string $field_name) : bool
    {
        if (false === $this->validated) {
            $this->validate();
        }
        return (false === $this->getErrorByFieldName($field_name));
    }