Simple fields are fields that only consist of one column in the metamodel table and therefore do not need to be handled as complex fields must be.
Inheritance: extends Base, implements MetaModels\Attribute\ISimple
示例#1
0
 /**
  * {@inheritdoc}
  */
 public function getFieldDefinition($arrOverrides = array())
 {
     $arrFieldDef = parent::getFieldDefinition($arrOverrides);
     $arrFieldDef['inputType'] = 'text';
     $arrFieldDef['eval']['rgxp'] = 'digit';
     return $arrFieldDef;
 }
示例#2
0
 /**
  * {@inheritdoc}
  *
  * @SuppressWarnings(PHPMD.Superglobals)
  * @SuppressWarnings(PHPMD.CamelCaseVariableName)
  */
 public function getFilterOptions($idList, $usedOnly, &$arrCount = null)
 {
     if (!($idList || $usedOnly)) {
         return array('0' => $GLOBALS['TL_LANG']['MSC']['metamodelattribute_checkbox']['value_0'], '1' => $GLOBALS['TL_LANG']['MSC']['metamodelattribute_checkbox']['value_1']);
     }
     return parent::getFilterOptions($idList, $usedOnly, $arrCount);
 }
 /**
  * {@inheritdoc}
  */
 public function getFieldDefinition($arrOverrides = array())
 {
     $arrFieldDef = parent::getFieldDefinition($arrOverrides);
     $arrFieldDef['inputType'] = 'text';
     // We do not need to set mandatory, as we will automatically update our value when isunique is given.
     if ($this->get('isunique')) {
         $arrFieldDef['eval']['mandatory'] = false;
     }
     return $arrFieldDef;
 }
示例#4
0
 /**
  * {@inheritDoc}
  */
 public function getFieldDefinition($arrOverrides = array())
 {
     $arrFieldDef = parent::getFieldDefinition($arrOverrides);
     $arrFieldDef['inputType'] = 'text';
     $arrFieldDef['eval']['maxlength'] = 6;
     $arrFieldDef['eval']['size'] = 2;
     $arrFieldDef['eval']['multiple'] = true;
     $arrFieldDef['eval']['isHexColor'] = true;
     $arrFieldDef['eval']['decodeEntities'] = true;
     $arrFieldDef['eval']['tl_class'] .= ' wizard inline';
     return $arrFieldDef;
 }
示例#5
0
 /**
  * {@inheritDoc}
  */
 public function getFieldDefinition($arrOverrides = array())
 {
     $arrFieldDef = parent::getFieldDefinition($arrOverrides);
     $arrFieldDef['inputType'] = 'text';
     // W do not need to set mandatory, as we will automatically update our value when isunique is given.
     if ($this->get('isunique')) {
         $arrFieldDef['eval']['mandatory'] = false;
     }
     // If "force_alias" is ture set alwaysSave to true.
     if ($this->get('force_alias')) {
         $arrFieldDef['eval']['alwaysSave'] = true;
     }
     return $arrFieldDef;
 }
示例#6
0
 /**
  * {@inheritdoc}
  */
 public function getFieldDefinition($arrOverrides = array())
 {
     $arrFieldDef = parent::getFieldDefinition($arrOverrides);
     $arrFieldDef['inputType'] = 'text';
     if (!isset($arrFieldDef['eval']['tl_class'])) {
         $arrFieldDef['eval']['tl_class'] = '';
     }
     $arrFieldDef['eval']['tl_class'] .= ' wizard inline';
     if (!$this->get('trim_title')) {
         $arrFieldDef['eval']['size'] = 2;
         $arrFieldDef['eval']['multiple'] = true;
         $arrFieldDef['eval']['tl_class'] .= ' metamodelsattribute_url';
     }
     /** @var \Symfony\Component\EventDispatcher\EventDispatcherInterface $dispatcher */
     $dispatcher = $this->getMetaModel()->getServiceContainer()->getEventDispatcher();
     $dispatcher->addListener(ManipulateWidgetEvent::NAME, array(new UrlWizardHandler($this->getMetaModel(), $this->getColName()), 'getWizard'));
     return $arrFieldDef;
 }
示例#7
0
 /**
  * {@inheritDoc}
  *
  * @SuppressWarnings(PHPMD.UnusedLocalVariable)
  */
 public function getFilterOptions($idList, $usedOnly, &$arrCount = null)
 {
     $options = parent::getFilterOptions($idList, $usedOnly, $arrCount);
     foreach ($options as $k => $v) {
         $options[$k] = $this->getCountryLabel($k);
     }
     // Sort the result, see #11
     asort($options, SORT_LOCALE_STRING);
     return $options;
 }
示例#8
0
 /**
  * Search all items that match the given expression.
  *
  * Base implementation, perform string matching search.
  * The standard wildcards * (many characters) and ? (a single character) are supported.
  *
  * @param string $strPattern The text to search for. This may contain wildcards.
  *
  * @return int[] the ids of matching items.
  */
 public function searchFor($strPattern)
 {
     // If search with wildcard => parent implementation with "LIKE" search.
     if (false !== strpos($strPattern, '*') || false !== strpos($strPattern, '?')) {
         return parent::searchFor($strPattern);
     }
     // Not with wildcard but also not numeric, impossible to get decimal results.
     if (!is_numeric($strPattern)) {
         return array();
     }
     // Do a simple search on given column.
     $query = $this->getMetaModel()->getServiceContainer()->getDatabase()->prepare(sprintf('SELECT id FROM %s WHERE %s=?', $this->getMetaModel()->getTableName(), $this->getColName()))->execute($strPattern);
     return $query->fetchEach('id');
 }
示例#9
0
 /**
  * {@inheritDoc}
  */
 public function getFieldDefinition($arrOverrides = array())
 {
     $arrFieldDef = parent::getFieldDefinition($arrOverrides);
     $arrFieldDef['inputType'] = 'textarea';
     return $arrFieldDef;
 }
示例#10
0
 /**
  * {@inheritDoc}
  */
 protected function prepareTemplate(Template $objTemplate, $arrRowData, $objSettings)
 {
     parent::prepareTemplate($objTemplate, $arrRowData, $objSettings);
     $objToolbox = new ToolboxFile();
     $objToolbox->setBaseLanguage($this->getMetaModel()->getActiveLanguage());
     $objToolbox->setFallbackLanguage($this->getMetaModel()->getFallbackLanguage());
     $objToolbox->setLightboxId(sprintf('%s.%s.%s', $this->getMetaModel()->getTableName(), $objSettings->get('id'), $arrRowData['id']));
     if (strlen($this->get('file_validFileTypes'))) {
         $objToolbox->setAcceptedExtensions($this->get('file_validFileTypes'));
     }
     $objToolbox->setShowImages($objSettings->get('file_showImage'));
     if ($objSettings->get('file_imageSize')) {
         $objToolbox->setResizeImages($objSettings->get('file_imageSize'));
     }
     if ($arrRowData[$this->getColName()]) {
         $value = $arrRowData[$this->getColName()];
         if (isset($value['value'])) {
             foreach ($value['value'] as $strFile) {
                 $objToolbox->addPathById($strFile);
             }
         } elseif (is_array($value)) {
             foreach ($value as $strFile) {
                 $objToolbox->addPathById($strFile);
             }
         } else {
             $objToolbox->addPathById($value);
         }
     }
     $objToolbox->resolveFiles();
     $arrData = $objToolbox->sortFiles($objSettings->get('file_sortBy'));
     $objTemplate->files = $arrData['files'];
     $objTemplate->src = $arrData['source'];
 }
示例#11
0
 /**
  * {@inheritDoc}
  *
  * @SuppressWarnings(PHPMD.UnusedLocalVariable)
  */
 public function getFilterOptions($idList, $usedOnly, &$arrCount = null)
 {
     $options = parent::getFilterOptions($idList, $usedOnly, $arrCount);
     foreach ($options as $k => $v) {
         $options[$k] = $this->getCountryLabel($k);
     }
     return $options;
 }
示例#12
0
 /**
  * {@inheritDoc}
  */
 public function getFieldDefinition($arrOverrides = array())
 {
     $arrFieldDef = parent::getFieldDefinition($arrOverrides);
     $arrFieldDef['inputType'] = 'select';
     $arrFieldDef['eval']['chosen'] = true;
     $arrFieldDef['options'] = array_intersect_key($this->getLanguageNames(), array_flip((array) $this->get('langcodes')));
     return $arrFieldDef;
 }