Get the default title for this field from the form field.

@param bool $force Force a non-empty title to be returned.
@return string
172347
public function getDefaultTitle($force = true)
    {
        $fields = $this->getMemberFields();
        $field  = $fields->dataFieldByName($this->MemberField);
        $title  = $field->Title();

        if (!$title && $force) {
            $title = $field->getName();
        }

        return $title;
    }
1327620
public function getTitleField()
    {
        if ($this->title_field && $this->hasElement($this->title_field)) {
            return $this->title_field;
        }

        return $this->id_field;
    }
780270
public function configureDefaults(array $defaults, $force = false)
    {
        if ($force || empty($this->toArray())) {
            $attachmentDefaults = $this->attachmentDefaults;

            foreach (MessageDefaults::allKeys() as $key) {
                if (isset($defaults[$key]) && ! is_null($value = $defaults[$key])) {
                    if (strpos($key, 'attachment_') !== false) {
                        if ($key = substr($key, strlen('attachment_'))) {
                            $attachmentDefaults[$key] = $value;
                        }
                    } else {
                        $this->fillDefaults($key, $value);
                    }
                }
            }

            $this->setAttachmentDefaults($attachmentDefaults);
        }

        return $this;
    }
796041
public function render($force = false) {

        if(empty($this->html) || $force) {

            if($this->selected) {
                $this->attributes['selected'] = 'selected';
            }
            else {
                unset($this->attributes['selected']);
            }

            $this->attributes['value'] = $this->getValue();

            $attr = [];

            foreach($this->attributes as $k => $v) {
                $attr[] = sprintf('%s="%s"', $k, $v);
            }

            $this->html = sprintf(
				'<option %s>%s</option>',
                implode(' ', $attr),
				$this->getLabel()->getLabelText()
			);
		}

		return $this->html;

	}
813909
protected function getTitle()
	{
		$title = '';

		if ($this->hidden)
		{
			return $title;
		}

		// Get the label text from the XML element, defaulting to the element name.
		$title = $this->element['label'] ? (string) $this->element['label'] : (string) $this->element['name'];
		$title = $this->translateLabel ? $this->getText()->translate($title) : $title;

		return $title;
	}
726531
protected String getTitle(String option, String defaultValue) {

        if ((option != null) && m_titles.containsKey(option)) {
            return m_titles.get(option);
        }
        return defaultValue;
    }
951425
public function get_talkID( $force = false ) {

		if( !$force ) {
			return $this->talkid;
		}

		$tArray = array(
			'action' => 'query',
			'prop'   => 'info',
			'inprop' => 'talkid',
			'titles' => $this->title,
		);

		pecho( "Getting talk page ID for {$this->title}..\n\n", PECHO_NORMAL );

		$tRes = $this->wiki->apiQuery( $tArray );

		if( isset( $tRes['query']['pages'][$this->pageid]['talkid'] ) ) {
			$this->talkid = $tRes['query']['pages'][$this->pageid]['talkid'];
		} else $this->talkid = null;

		return $this->talkid;
	}
581969
public function generateTokenHTML($force=false) {
		if( $force ) {
			$token	= $this->generateToken();
		} else {
			if( !isset($this->lastToken) ) {
				$this->lastToken	= $this->generateToken();
			}
			$token	= $this->lastToken;
		}
		return '<input type="hidden" name="'.self::HTML_PREFIX.$this->name.'" value="'.$token.'" />';
	}
351309
public function getCTAs($force = false)
    {
        if ($this->nb_site_target_cta_list->isEmpty() || $force) {
            $this->nb_site_target_cta_list->clear();
            $this->nb_site_target_cta_list->merge(CNabuSiteTargetCTA::getSiteTargetCTAs($this));
            $translations = CNabuSiteTargetCTALanguage::getCTATranslationsForSiteTarget($this);
            if (is_array($translations) && count($translations) > 0) {
                foreach ($translations as $translation) {
                    $nb_site_target_cta = $this->nb_site_target_cta_list->getItem($translation->getSiteTargetCTAId());
                    if ($nb_site_target_cta instanceof CNabuSiteTargetCTA) {
                        $nb_site_target_cta->setTranslation($translation);
                    }
                }
            }
            $roles = CNabuSiteTargetCTARole::getCTARolesForSiteTarget($this);
            if (is_array($roles) && count($roles) > 0) {
                foreach ($roles as $role) {
                    $nb_site_target_cta = $this->nb_site_target_cta_list->getItem($role->getSiteTargetCTAId());
                    if ($nb_site_target_cta instanceof CNabuSiteTargetCTA) {
                        $nb_site_target_cta->addRole($role);
                    }
                }
            }
        }

        return $this->nb_site_target_cta_list;
    }
1329629
public function get_subjectid( $force = false ) {

		if( !$force ) {
			return $this->subjectid;
		}

		$tArray = array(
			'action' => 'query',
			'prop'   => 'info',
			'inprop' => 'subjectid',
			'titles' => $this->title,
		);

		pecho( "Getting the parent page ID for {$this->title}..\n\n", PECHO_NORMAL );

		$tRes = $this->wiki->apiQuery( $tArray );

		if( isset( $tRes['query']['pages'][$this->pageid]['subjectid'] ) ) {
			$this->subjectid = $tRes['query']['pages'][$this->pageid]['subjectid'];
		} else $this->subjectid = null;

		return $this->subjectid;
	}
936120
public function provideFlatten($force = TRUE) {

     if ($this->isEmpty()) {
       $this->flattenjson = [];
     }
     else {
       if ($this->flattenjson == NULL || $force) {
         $mainproperty = $this->mainPropertyName();
         $jsonArray = json_decode($this->{$mainproperty}, TRUE, 10);
         $flattened = [];
         StrawberryfieldJsonHelper::arrayToFlatCommonkeys(
           $jsonArray,
           $flattened,
           TRUE
         );
         $this->flattenjson = $flattened;
       }
     }
     return $this->flattenjson;
   }
646169
public function get($force = false)
    {
        if (is_null($this->settings) || $force) {
            $_settings = $this->db->select()
                ->from($this->getTable())
                ->get();
            $settings = array();
            foreach ($_settings as $setting) {
                // decrypt the value if needed
                if (in_array($setting['setting_key'], $this->getEncrypted()) && ! empty($setting['setting_value'])) {
                    $settings[$setting['setting_key']] = $setting['setting_value'] = $this->getEncrypt()->decode($setting['setting_value']);
                }
                
                // unserialize the value
                if (in_array($setting['setting_key'], $this->getSerialized()) && ! empty($setting['setting_value'])) {
                    $settings[$setting['setting_key']] = $setting['setting_value'] = unserialize($setting['setting_value']);
                    foreach ($settings[$setting['setting_key']] as $key => $value) {
                        if ($value == '') {
                            unset($settings[$setting['setting_key']][$key]); // remove blank entries
                        }
                    }
                }
                
                // sort out new line values
                if (in_array($setting['setting_key'], $this->getNewLines())) {
                    $settings[$setting['setting_key']] = $setting['setting_value'] = explode("\n", $setting['setting_value']);
                    foreach ($settings[$setting['setting_key']] as $key => $value) {
                        $value = trim($value);
                        if ($value == '') {
                            unset($settings[$setting['setting_key']][$key]); // remove blank entries
                        } else {
                            $settings[$setting['setting_key']][$key] = $value;
                        }
                    }
                }
                
                $settings[$setting['setting_key']] = $setting['setting_value'];
            }
            
            $ignore = array(
                'license_check',
                'license_status'
            );
            foreach ($this->getDefaults() as $key => $value) {
                // setup the override check
                if (isset($this->overrides[$key]) && ! in_array($key, $ignore)) {
                    $settings[$key] = $this->overrides[$key];
                }
                
                if (! isset($settings[$key])) {
                    $settings[$key] = $value;
                }
            }
            
            $this->settings = $settings;
            
            if($this->settings['api_key'] == '')
            {
                $this->settings['api_key'] = $this->getEncrypt()->guid();
            }
            
            if($this->settings['api_secret'] == '')
            {
                $this->settings['api_secret'] = $this->getEncrypt()->guid();
            }            
        }
        
        return $this->settings;
    }
635365
public static function getTitle($default = '') {
        if (empty(self::$viewContext->title)) {
            if (isset(self::$viewContext->body) && !empty(self::$viewContext->body->title)) {
                return htmlspecialchars(self::$viewContext->body->title);
            }
            else {
                return htmlspecialchars($default);
            }
        }
        else
        {
            return htmlspecialchars(self::$viewContext->title);
        }
    }
1363447
public function getRelativePath($force = FALSE) {

		if(!is_null($this->folder->getRelativePath())) {
			return $this->folder->getRelativePath() . $this->filename;
		}

	}
1236470
public function save($force = false) {
        if (!$this->writeable) {
            return false;
        }

        if (!$this->dirty && !$force) {
            return null;
        }

        $savetype = $force ? 'forced ' : '';
        if (is_null($force)) {
            $savetype = 'auto ';
        }

        $path = dirname($this->file);
        if (!is_dir($path)) {
            mkdir($path, 0755, true);
        }

        $data = $this->store->dump();
        $conf = version_compare(PHP_VERSION, '5.4', '>=') ? json_encode($data, JSON_PRETTY_PRINT) : json_encode($data);
        unset($data);
        if (!$conf || !json_decode($conf)) {
            return;
        }
        $saved = (bool)$this->writeAtomic($this->file, $conf, 0755);

        if ($saved) {
            $this->dirty = false;
        }

        return $saved;
    }
742690
public function get_text( $force = false, $section = null ) {
		pecho( "Getting page content for {$this->title}..\n\n", PECHO_NOTICE );

		if( !$this->exists ) return null;

		if( !is_null( $section ) ) {
			if( empty( $this->content ) ) {
				$this->content = $this->history( 1, "older", true );
				$this->content = $this->content[0]['*'];
			}

			$sections = $this->wiki->apiQuery(
				array(
					'action' => 'parse',
					'page'   => $this->title,
					'prop'   => 'sections'
				)
			);

			if( !is_numeric( $section ) ) {
				foreach( $sections['parse']['sections'] as $section3 ){
					if( $section3['line'] == $section ) {
						$section = $section3['number'];
					}
				}
			}

			if( !is_numeric( $section ) ) {
				pecho( "Warning: Section not found.\n\n", PECHO_WARN );
				return false;
			}

			$offsets = array( '0' => '0' );

			if( $this->wiki->get_mw_version() < '1.16' ) {

				//FIXME: Implement proper notice suppression

				$ids = array();

				foreach( $sections['parse']['sections'] as $section3 ){
					$ids[$section3['line']] = $section3['number'];
				}

				$regex = '/^(=+)\s*(.*?)\s*(\1)\s*/m';

				preg_match_all( $regex, $this->content, $m, PREG_OFFSET_CAPTURE | PREG_SET_ORDER );

				foreach( $m as $id => $match ){
					$offsets[$id + 1] = $match[0][1];
				}

			} else {
				foreach( $sections['parse']['sections'] as $section2 ){
					$offsets[$section2['number']] = $section2['byteoffset'];
				}
			}

			if( intval( $section ) != count( $offsets ) - 1 ) {
				$length = $offsets[$section + 1] - $offsets[$section];
			}

			if( isset( $length ) ) {
				$substr = mb_substr( $this->content, $offsets[$section], $length );
			} else {
				$substr = mb_substr( $this->content, $offsets[$section] );
			}

			return $substr;
		} else {
			if( !$force && $this->content !== null ) {
				return $this->content;
			}

			$this->content = $this->history( 1, "older", true );
			$this->content = $this->content[0]['*'];

			return $this->content;
		}
	}
96949
public function getPrescriber(bool $force = false)
    {
        if ($this->nb_prescriber == NULL ||
            $this->nb_prescriber->getId() != $this->getPrescriberId() ||
            $force
        ) {
            $nb_prescriber_id = $this->getPrescriberId();
            if ($nb_prescriber_id === null || $this->getCustomer() === null) {
                $this->nb_prescriber = null;
            } else {
                $this->nb_prescriber = $this->getCustomer()->getUser($nb_prescriber_id);
            }
        }

        return $this->nb_prescriber;
    }