3 namespace wcf\data\bbcode\attribute
;
5 use wcf\data\bbcode\BBCode
;
6 use wcf\data\DatabaseObject
;
9 * Represents a bbcode attribute.
11 * @author Tim Duesterhus, Alexander Ebert
12 * @copyright 2001-2019 WoltLab GmbH
13 * @license GNU Lesser General Public License <http://opensource.org/licenses/lgpl-license.php>
14 * @package WoltLabSuite\Core\Data\Bbcode\Attribute
16 * @property-read int $attributeID unique id of the bbcode attribute
17 * @property-read int $bbcodeID id of the bbcode the attribute belongs to
18 * @property-read int $attributeNo number of bbcode attribute
19 * @property-read string $attributeHtml html code used to render the bbcode attribute or empty if no such html code exists
20 * @property-read string $validationPattern regular expression used to validate the bbcode attribute's value or empty if no such regular expression exists
21 * @property-read int $required is `1` if the bbcode attribute is required of the bbcode, otherwise `0`
22 * @property-read int $useText is `1` if the bbcode's content will be used as the bbcode attribute value
24 class BBCodeAttribute
extends DatabaseObject
29 protected static $databaseTableName = 'bbcode_attribute';
32 * Reads attributes by assigned bbcode.
34 * @param BBCode $bbcode
35 * @return BBCodeAttribute[]
37 public static function getAttributesByBBCode(BBCode
$bbcode)
39 $attributeList = new BBCodeAttributeList();
40 $attributeList->sqlOrderBy
= "bbcode_attribute.attributeNo ASC";
41 $attributeList->getConditionBuilder()->add('bbcode_attribute.bbcodeID = ?', [$bbcode->bbcodeID
]);
42 $attributeList->readObjects();
44 return $attributeList->getObjects();