Redaxscript\Template\Helper::getKeywords PHP Метод

getKeywords() публичный статический Метод

get the keywords
С версии: 3.0.0
public static getKeywords ( ) : string
Результат string
    public static function getKeywords()
    {
        $lastTable = Registry::get('lastTable');
        $lastId = Registry::get('lastId');
        $metaKeywords = Registry::get('metaKeywords');
        /* find keywords */
        if ($metaKeywords) {
            $keywords = $metaKeywords;
        } else {
            if ($lastTable && $lastId) {
                $lastContent = Db::forTablePrefix($lastTable)->whereIdIs($lastId)->findOne();
                $keywords = $lastContent->keywords;
            }
        }
        /* handle keywords */
        if ($keywords) {
            return $keywords;
        }
        return Db::getSetting('keywords');
    }

Usage Example

Пример #1
0
 /**
  * testGetKeywords
  *
  * @since 3.0.0
  *
  * @param array $registryArray
  * @param string $expect
  *
  * @dataProvider providerGetKeywords
  */
 public function testGetKeywords($registryArray = [], $expect = null)
 {
     /* setup */
     $this->_registry->init($registryArray);
     /* actual */
     $actual = Template\Helper::getKeywords();
     /* compare */
     $this->assertEquals($expect, $actual);
 }