本文整理汇总了PHP中EB::fields方法的典型用法代码示例。如果您正苦于以下问题:PHP EB::fields方法的具体用法?PHP EB::fields怎么用?PHP EB::fields使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类EB
的用法示例。
在下文中一共展示了EB::fields方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: getForm
/**
* Retrieve a custom field form
*
* @since 4.0
* @access public
* @param string
* @return
*/
public function getForm()
{
// Get the field id
$id = $this->input->get('id', 0, 'int');
// Get the field type
$type = $this->input->get('type', '', 'cmd');
if (!$type) {
return $this->ajax->reject();
}
$field = EB::table('Field');
$field->load($id);
// Get the form
$form = EB::fields()->get($type)->admin($field);
return $this->ajax->resolve($form);
}
示例2: getCustomFields
/**
* Retrieves the custom fields
*
* @since 4.0
* @access public
* @param string
* @return
*/
public function getCustomFields($id)
{
$db = EB::db();
$query = 'SELECT a.* FROM ' . $db->quoteName('#__easyblog_fields') . ' AS a';
$query .= ' INNER JOIN ' . $db->quoteName('#__easyblog_category_fields_groups') . ' AS b';
$query .= ' ON a.' . $db->quoteName('group_id') . '= b.' . $db->quoteName('group_id');
$query .= ' WHERE b.' . $db->quoteName('category_id') . '=' . $db->Quote($id);
$query .= ' AND a.' . $db->quoteName('state') . '=' . $db->Quote(1);
$db->setQuery($query);
$result = $db->loadObjectList();
if (!$result) {
return $result;
}
// Get the fields library
$lib = EB::fields();
// Initialize the default value
$fields = array();
foreach ($result as $row) {
$field = EB::table('Field');
$field->bind($row);
$fields[] = $field;
}
return $fields;
}
示例3: index
/**
* Indexes a post on the site
*
* @since 5.0
* @access public
* @param FinderIndexerResult The item to index
* @param string The item's format
* @return void
*/
protected function index(FinderIndexerResult $item, $format = 'html')
{
// Check if the extension is enabled
if (!$this->exists()) {
return;
}
// Build the necessary route and path information.
$item->url = 'index.php?option=com_easyblog&view=entry&id=' . $item->id;
$item->route = EBR::getRoutedURL($item->url, false, true);
// Remove any /administrator/ segments from the url since the indexer could be executed from the back end
$item->route = $this->removeAdminSegment($item->route);
// Get the content path
$item->path = FinderIndexerHelper::getContentPath($item->route);
// If there is access defined, just set it to 2 which is special privileges.
if (!$item->access || $item->access == 0) {
$item->access = 1;
} else {
if ($item->access > 0) {
$item->access = 2;
}
}
// Load up the post item
$post = EB::post();
$post->load($item->id);
// Get the intro text of the content
$item->summary = $post->getIntro();
// Get the contents
$item->body = $post->getContent('entry', false);
// If the post is password protected, we do not want to display the contents
if ($post->isPasswordProtected()) {
$item->summary = JText::_('PLG_FINDER_EASYBLOG_PASSWORD_PROTECTED');
} else {
// we want to get custom fields values.
$fields = $post->getCustomFields();
$fieldlib = EB::fields();
$customfields = array();
if ($fields) {
foreach ($fields as $field) {
if ($field->group->hasValues($post)) {
foreach ($field->fields as $customField) {
$eachField = $fieldlib->get($customField->type);
$customfields[] = $eachField->text($customField, $post);
}
}
}
$customfieldvalues = implode(' ', $customfields);
$item->body = $item->body . ' ' . $customfieldvalues;
}
}
// Add the author's meta data
$item->metaauthor = !empty($item->created_by_alias) ? $item->created_by_alias : $item->author;
$item->author = !empty($item->created_by_alias) ? $item->created_by_alias : $item->author;
// If the post has an image, use it
$image = $post->getImage('thumbnail', false, true);
// If there's no image, try to scan the contents for an image to be used
if (!$image && $post->isLegacy()) {
$image = EB::string()->getImage($item->body);
}
// If we still can't locate any images, use the placeholder image
if (!$image) {
$image = EB::getPlaceholderImage();
}
$registry = new JRegistry();
$registry->set('image', $image);
$item->params = $registry;
// Add the meta-data processing instructions.
$item->addInstruction(FinderIndexer::META_CONTEXT, 'metakey');
$item->addInstruction(FinderIndexer::META_CONTEXT, 'metadesc');
$item->addInstruction(FinderIndexer::META_CONTEXT, 'metaauthor');
$item->addInstruction(FinderIndexer::META_CONTEXT, 'author');
// Add the type taxonomy data.
$item->addTaxonomy('Type', 'EasyBlog');
// Add the author taxonomy data.
if (!empty($item->author) || !empty($item->created_by_alias)) {
$item->addTaxonomy('Author', !empty($item->created_by_alias) ? $item->created_by_alias : $item->author);
}
// Add the category taxonomy data.
$item->addTaxonomy('Category', $item->category, $item->cat_state, $item->cat_access);
// Add the language taxonomy data.
if (empty($item->language)) {
$item->language = '*';
}
$item->addTaxonomy('Language', $item->language);
// Get content extras.
FinderIndexerHelper::getContentExtras($item);
// For Joomla 3.0, the indexer is assigned to the property
// Index the item.
if (EB::isJoomla30()) {
return $this->indexer->index($item);
}
return FinderIndexer::index($item);
//.........这里部分代码省略.........
示例4: form
/**
* Displays the new group form
*
* @since 4.0
* @access public
* @param string
* @return
*/
public function form($tpl = null)
{
$this->checkAccess('easyblog.manage.fields');
$id = $this->input->get('id', 0, 'int');
// Get the field table
$field = EB::table('Field');
$field->load($id);
if (!$id) {
$title = 'COM_EASYBLOG_FIELDS_CREATE_TITLE';
} else {
$title = 'COM_EASYBLOG_FIELDS_EDIT_TITLE';
}
// Set page details
$this->setHeading($title, '', 'fa-list-alt');
JToolBarHelper::title(JText::_($title), 'fields');
JToolbarHelper::apply('fields.apply');
JToolbarHelper::save('fields.save');
JToolbarHelper::save2new('fields.savenew');
JToolBarHelper::cancel('fields.cancel');
// Get the fieldsgroup model
$model = EB::model('Fields');
$groups = $model->getGroups();
if (!$groups) {
return parent::display('fields/form.nogroups');
}
// Get the custom fields library
$fields = EB::fields()->getItems();
// Get the current active field form
$form = '';
if ($field->id) {
$form = EB::fields()->get($field->type)->admin($field);
}
$this->set('fields', $fields);
$this->set('form', $form);
$this->set('field', $field);
$this->set('groups', $groups);
parent::display('fields/form');
}
示例5: getForm
/**
* Retrieves the form
*
* @since 4.0
* @access public
* @param string
* @return
*/
public function getForm(EasyBlogPost $post, $elementName = 'fields')
{
$fields = EB::fields();
$field = $fields->get($this->type);
$field->setFormElement($elementName);
return $field->form($post, $this);
}