SourceString.php

Same filename and directory in other branches
  1. 9 core/modules/locale/src/SourceString.php
  2. 8.9.x core/modules/locale/src/SourceString.php
  3. 10 core/modules/locale/src/SourceString.php

Namespace

Drupal\locale

File

core/modules/locale/src/SourceString.php

View source
<?php

namespace Drupal\locale;


/**
 * Defines the locale source string object.
 *
 * This class represents a module-defined string value that is to be translated.
 * This string must at least contain a 'source' field, which is the raw source
 * value, and is assumed to be in English language.
 */
class SourceString extends StringBase {
    
    /**
     * {@inheritdoc}
     */
    public function isSource() {
        return isset($this->source);
    }
    
    /**
     * {@inheritdoc}
     */
    public function isTranslation() {
        return FALSE;
    }
    
    /**
     * {@inheritdoc}
     */
    public function getString() {
        return $this->source ?? '';
    }
    
    /**
     * {@inheritdoc}
     */
    public function setString($string) {
        $this->source = $string;
        return $this;
    }
    
    /**
     * {@inheritdoc}
     */
    public function isNew() {
        return empty($this->lid);
    }

}

Classes

Title Deprecated Summary
SourceString Defines the locale source string object.

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.