当前位置: 首页>>代码示例>>PHP>>正文


PHP Field::get方法代码示例

本文整理汇总了PHP中Field::get方法的典型用法代码示例。如果您正苦于以下问题:PHP Field::get方法的具体用法?PHP Field::get怎么用?PHP Field::get使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Field的用法示例。


在下文中一共展示了Field::get方法的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: get

 public function get($key)
 {
     if ($key == 'id') {
         return 0;
     }
     if ($key == 'name') {
         return '';
     }
     return parent::get($key);
 }
开发者ID:posixpascal,项目名称:TrooperCMS,代码行数:10,代码来源:NullField.php

示例2: isValid

 /**
  * Check that the file matches the validator as specified by the field
  *
  * @param Field $field
  * @param string $destination
  * @return boolean
  */
 public function isValid(Field $field, $destination = NULL)
 {
     $this->valid = true;
     // Check if file name length will not exceed maximum allowed by Upload field's database column.
     // Upload field does not check that, so we have to do that here.
     if (!empty($destination)) {
         $this->valid = strlen($destination) < 255 ? true : false;
         if (!$this->valid) {
             $this->errors[] = __("Length of file name chosen in '%s' exceeds maximum allowed for that field.", array($field->get('label')));
         }
     }
     return $this->valid;
 }
开发者ID:brendo,项目名称:bulkimporter,代码行数:20,代码来源:class.file.php

示例3: getRadioCheckHtml

 /**
  * Generates the html code of a checkbox/radio field
  *
  * @param Field $field
  *
  * @return string
  */
 private static function getRadioCheckHtml($field)
 {
     //Errors
     if ($field->error()) {
         $field->errorLabel->addClass('text-danger');
     }
     $html = $field->input->toHtml();
     $html = $field->label->toHtml($html . ' ') . $field->errorLabel;
     $html = Element::div(true)->class($field->input->attr('type'))->toHtml($html);
     //Help block
     if ($help = $field->get('help')) {
         $html .= Element::span(true)->class('help-block')->toHtml($help);
     }
     return $html;
 }
开发者ID:oscarotero,项目名称:form-manager-bootstrap,代码行数:22,代码来源:Bootstrap.php

示例4: __wrapFieldWithDiv

 /**
  * Given a Field and Entry object, this function will wrap
  * the Field's displayPublishPanel result with a div that
  * contains some contextual information such as the Field ID,
  * the Field handle and whether it is required or not.
  *
  * @param Field $field
  * @param Entry $entry
  * @return XMLElement
  */
 private function __wrapFieldWithDiv(Field $field, Entry $entry)
 {
     $div = new XMLElement('div', NULL, array('id' => 'field-' . $field->get('id'), 'class' => 'field field-' . $field->handle() . ($field->get('required') == 'yes' ? ' required' : '')));
     $field->displayPublishPanel($div, $entry->getData($field->get('id')), isset($this->_errors[$field->get('id')]) ? $this->_errors[$field->get('id')] : NULL, null, null, is_numeric($entry->get('id')) ? $entry->get('id') : NULL);
     return $div;
 }
开发者ID:nickdunn,项目名称:elasticsearch-surfin-shakespeare,代码行数:16,代码来源:content.publish.php

示例5: __wrapFieldWithDiv

 private function __wrapFieldWithDiv(Field $field, Entry $entry, $prefix = null, $postfix = null, $css = null)
 {
     $div = new XMLElement('div', NULL, array('class' => 'field field-' . $field->handle() . ($field->get('required') == 'yes' ? ' required' : '')));
     if ($css != null) {
         $div->setAttribute('style', $css);
     }
     $field->displayPublishPanel($div, $_POST['fields'][$field->get('element_name')], isset($this->_errors[$field->get('id')]) ? $this->_errors[$field->get('id')] : NULL, $prefix ? '[' . $prefix . ']' : null, null, is_numeric($entry->get('id')) ? $entry->get('id') : NULL);
     return $div;
 }
开发者ID:bauhouse,项目名称:sym-extensions,代码行数:9,代码来源:content.inject.php

示例6: registerField

 public function registerField(Field $field)
 {
     self::$fields[$field->get('id')] = $field;
 }
开发者ID:symphonists,项目名称:reflectionfield,代码行数:4,代码来源:extension.driver.php

示例7: isFieldHidden

 /**
  * Check whether the given `$field` will be hidden because it's been
  * prepopulated.
  *
  * @param  Field  $field
  * @return boolean
  */
 public function isFieldHidden(Field $field)
 {
     if ($field->get('hide_when_prepopulated') == 'yes') {
         if (isset($_REQUEST['prepopulate'])) {
             foreach ($_REQUEST['prepopulate'] as $field_id => $value) {
                 if ($field_id == $field->get('id')) {
                     return true;
                 }
             }
         }
     }
     return false;
 }
开发者ID:rc1,项目名称:WebAppsWithCmsStartHere,代码行数:20,代码来源:content.publish.php

示例8: getRows

 public static function getRows($db, $filters = null, $page = 1, $sort = null)
 {
     //grab the model instance
     $model = $config->model;
     //update the config sort options
     $config->setSort($sort);
     $sort = $config->sort;
     //get things going by grouping the set
     $query = $model::group_by($model->table() . '.' . $model::$key);
     //set up initial array states for the selects
     //*************
     // the problem originated here
     // according to PostgreSQL if you want to select something you have to group your result by it (only if you using gruop by statement)
     // you can either get id and then get the rest of fields using id or you can put all columns of table in group_by statement
     // I chose the first approach
     // so i'm selecting just the id and then i will get the rest of row using id
     $selects = array(DB::raw($model->table() . '.' . $model::$key));
     //**************
     //then we set the filters
     if ($filters && is_array($filters)) {
         foreach ($filters as $filter) {
             if (!($fieldObject = Field::get($filter['field'], $filter, $config))) {
                 continue;
             }
             $fieldObject->filterQuery($query, $model);
         }
     }
     //determines if the sort should have the table prefixed to it
     $sortOnTable = true;
     //iterate over the columns to check if we need to join any values or add any extra columns
     foreach ($config->columns['columns'] as $field => $column) {
         //if this is a related column, we'll need to add some joins
         $column->filterQuery($query, $selects, $model);
         //if this is a related field or
         if (($column->isRelated || $column->select) && $column->field === $sort['field']) {
             $sortOnTable = false;
         }
     }
     //if the sort is on the model's table, prefix the table name to it
     if ($sortOnTable) {
         $sort['field'] = $model->table() . '.' . $sort['field'];
     }
     /**
      * We need to do our own pagination since there is a bug in the L3 paginator when using groupings :(
      * When L4 is released, this problem will go away and we'll be able to use the paginator again
      */
     //first get the sql sans selects
     $sql = $query->table->grammar->select($query->table);
     //then we need to round out the inner select
     $sql = "SELECT {$model->table()}.{$model::$key} " . $sql;
     //then wrap the inner table and perform the count
     $sql = "SELECT COUNT({$model::$key}) AS aggregate FROM ({$sql}) AS agg";
     //then perform the count query
     $results = $query->table->connection->query($sql, $query->table->bindings);
     $num_rows = $results[0]->aggregate;
     $page = (int) \Input::get('page', 1);
     $last = (int) ceil($num_rows / $config->rowsPerPage);
     //if the current page is greater than the last page, set the current page to the last page
     $page = $page > $last ? $last : $page;
     //now we need to limit and offset the rows in remembrance of our dear lost friend paginate()
     $query->take($config->rowsPerPage);
     $query->skip($config->rowsPerPage * ($page === 0 ? $page : $page - 1));
     //order the set by the model table's id
     $query->order_by($sort['field'], $sort['direction']);
     //then retrieve the rows
     $rows = $query->distinct()->get($selects);
     //*********
     // I also added this
     // here i got the rest of fields
     // I know you probebly asking why i didn't just join the query with table and be done with that
     // But that way it whoud not match the rest of code and I didn't want to mess with the rest of code
     for ($i = 0; $i < count($rows); $i++) {
         $rows[$i] = $model::find($rows[$i]->key);
     }
     //*********
     $results = array();
     //convert the resulting set into arrays
     foreach ($rows as $item) {
         //iterate over the included and related columns
         $onTableColumns = array_merge($config->columns['includedColumns'], $config->columns['relatedColumns']);
         $arr = array();
         foreach ($onTableColumns as $field => $col) {
             //if this column is in our objects array, render the output with the given value
             if (isset($config->columns['columnObjects'][$field])) {
                 $arr[$field] = $config->columns['columnObjects'][$field]->renderOutput($item->get_attribute($field));
             } else {
                 $arr[$field] = $item->get_attribute($field);
             }
         }
         //then grab the computed, unsortable columns
         foreach ($config->columns['computedColumns'] as $col) {
             $arr[$col] = $config->columns['columnObjects'][$col]->renderOutput($item->{$col});
         }
         $results[] = $arr;
     }
     return array('page' => $page, 'last' => $last, 'total' => $num_rows, 'results' => $results);
 }
开发者ID:Xoloitzcuintles,项目名称:viajesTransparentes,代码行数:97,代码来源:DataTable.php

示例9: createError

 /**
  * Given a Field instance, the type of error, and the message, this function
  * creates an XMLElement node so that it can be added to the `?debug` for the
  * Event
  *
  * @since Symphony 2.5.0
  * @param Field $field
  * @param string $type
  *  At the moment 'missing' or 'invalid' accepted
  * @param string $message
  * @return XMLElement
  */
 public static function createError(Field $field, $type, $message = null)
 {
     $error = new XMLElement($field->get('element_name'), null, array('label' => General::sanitize($field->get('label')), 'type' => $type, 'message-id' => $type === 'missing' ? EventMessages::FIELD_MISSING : EventMessages::FIELD_INVALID, 'message' => General::sanitize($message)));
     return $error;
 }
开发者ID:jurajkapsz,项目名称:symphony-2,代码行数:17,代码来源:class.event.section.php


注:本文中的Field::get方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。