texts: Show a view of Related Terms to a given Taxonomy term

texts:
How can I create a view and show only taxonomy terms related to the term you are currently viewing (term id in URL)? I have tried a handful of relationship and argument configurations, but can't seem to simply list the related terms to the term being viewed.

Edit: I have related the terms through the core taxonomy interface.


texts: Proper backup procedure for remote site?

texts:
I know variations of this question have already been asked here, but I could not find proper information on details for a backup procedure for a remote site. I am still new to Drupal.

Assuming a host handles multiple Drupal 7 sites under a /public_html directory, using the same MySQL installation:

/public_html/my_drupal_site_1/...
/public_html/my_drupal_site_2/...
/public_html/my_drupal_site_3/...
...

I see two situations to consider: i) Drush is not installed on the remote host, ii) Drush is installed on the remote host.

Regarding i), that is, Drush is not available:

What would be the proper step-by-step procedure to backup and restore my_drupal_site_2 on the remote host from a local pc, assuming the Backup & Migrate module is installed on this site?
Which part of the directory tree should be copied (eventually with FTP)?
Which part should be restored?
How to make sure only the part of the database for my_drupal_site_2 is backup and restored?
Does one need to create a database before restoring the back up?
Does one need to create an 'empty' Drupal site before restoring?

Regarding ii), that is, Drush is available, say via SSH on the remote site:

What would be the proper step-by-step procedure to backup and restore  my_drupal_site_2 on the remote host from a local pc, assuming the Backup & Migrate module is installed on this site?
Is there a way to synchronize a local directory tree from the remote directory tree? The idea is to put this content under subversion or git for example.

At last, is there a all-in-one solution? Like a script that could do everything at once? Thanks.


texts: Drupal 6 - How to check which module is caused high loading(high CPU usage)

texts:
I am running a Drupal 6 site on my server, when I use Linux command top to check the CPU usage, I always get a high figure 80-90% of CPU loading, so my server down frequently.

I have installed over 50 modules,I am going to check which module was caused high CPU usage, could someone suggest how can I check which module was caused high CPU usage(by code or module)?

Thanks


texts: Any twitter boostrap(ish) theme for Drupal 6?

texts:
I'd like to make a legacy D6 site's theme more responsive. I love to be able to use the omni-present twitter bootstrap theme or something that comes close to it in responsiveness. I know that there is a quite a few for drupal 7+  but could not fine any for D6 on Drupal site.

So I'm wondering if there is any mature D6 Bootstrap theme? And if not, how hard is it to convert a D7 theme to D6?


texts: How to hide node/add and */edit page titles

texts:
Need to change Drupal 8 node/add page titles - there have been some answers here (most for Drupal 7), but none of them have worked.

So there is always Create  in front of the title in add page - need to drop the part Create - how ?

Need to drop also word Edit  in from the already created node in edit mode - how ?

If someone can point me in right direction and give me _preprocess_node_add_list or some node preprocess sample.

Regards

Virgo


texts: Pitfalls when updating a site without entering maintenance mode?

texts:
Assuming there are no module updates that require doing a database update, if it's just an update to a newer minor release of Drupal core, as well as of contrib and custom modules, what potential pitfalls should I watch out for when updating without entering maintenance mode?

We have 3 load-balanced web servers that all point to the same database and file server. The updates are generally done by first putting all the 3 Drupal instances into maintenance mode, waiting for a minute or two (not sure if this is necessary), then literally overwriting the entire application root directory with the newer version on each server, then clearing the caches on each of the servers, then exiting maintenance mode.

Is it safe to do this overwriting of the files while the site is live, without entering maintenance mode? I've heard of people doing this, but they have brochureware sites with not a lot of traffic and not a lot of logged-in user sessions (which we do have). Does doing so become more or less safe if you have multiple load-balanced web servers, use APC, use Varnish in front of the web servers, use nginx, use Memcache (which also stores sessions) between the web servers and the DB, have all pages using SSL, etc?

It would be great to seamlessly roll over to a new version without having to enter maintenance mode, but it feels risky to me. Are there edge cases where if your new files take a couple of minutes to overwrite the old files in the application root, then maybe some users are getting loading one module from the old set of files and one module from the newly-copied set of files, leading to strange and non-reproducible errors?


texts: How to recalculate the price in d7 e-commerce depending on the number of attributes

texts: I need to increase the cost of the product each time a user attribute is added. Attribute is a text field available to the user in the product. The number of fields added must be multiplied by the base cost. How can this be implemented?


texts: Change the value of a taxonomy field on cron run

texts:
I have the article node with two extra fields:

Taxonomy reference field field_verification_status with two possible values:

Valid (tid: 272)
Expired (tid: 271)

Date field (field_article_expiry_date)

When a user will create a new article, will set:

Taxonomy reference field field_verification_status = Valid (tid: 272)
Date field (field_article_expiry_date) = Any time in the future.

Now using Ultimate Cron Module, I want on every cron run, to:

Check if the field_article_expiry_date value is less than current time (now)
if above return true then change the field_verification_status value to Expired (tid: 271)

To accomplish the above, I have created a new module custom_cron_expired_articles and in the .module file I added the below codes:

<?php

use Drupal\node\Entity\Node;
use Drupal\taxonomy\Entity\Term;

/**
 * Implements hook_cron().
 */

// On "Cron Run" and "Every Half Hour":
    // Loop through all "Valid" articles with expiry date set to the past,
    // Change the status of each article to "Expired".

function custom_cron_expired_articles_cron() {

  // Get the "cron time" (Return Value is in UNIX Timestamp format)
    //$cron_time = \Drupal::time()->getCurrentTime();
    //date_default_timezone_set('GMT');

// Load all available expired nodes of type 'offer'.
  $storage = \Drupal::entityTypeManager()
    ->getStorage('node');
  $query = \Drupal::entityQuery('node')
      ->accessCheck(FALSE)
      ->condition('type', 'article')
      ->condition('field_verification_status', 272)    // Verification Status = Valid
      ->condition('field_article_expiry_date', strtotime($?????), '<=')  // Something is missing here
      //->range(0,50);
  $nids = $query->execute();

// Loop through all expired nodes.
foreach ($nids as $nid) {

// Load the Node by its ID.
    $node = \Drupal\node\Entity\Node::load($nid);

    // Update the node.
    $node->field_verification_status->target_id = 271; // Verification Status = Expired

    // Save the updated node.
    $node->save();

// resetCache() in such a loop over all entities of one type avoids running out of memory.
\Drupal::entityManager()->getStorage('node')->resetCache(array($nid));
}
}

How to compare if the field_article_expiry_date is less than the current_time ? or by other words, how to load only the nodes with field_article_expiry_date less than the current_time?

Can somebody tell me what is the missing part ?


texts: Are HTML strings translatable through admin/config/regional/translate?

texts:
I'm on Drupal 7 and to easily add an image to a string, I did this:

<img src="/icons/icon_32.png" height="32" width="32" /> My text here

I used this technique in several places: field labels, views titles, field values, etc.

Now I'm translating the site.

As it turns out, using the standard translation interface and the i18n modules (views, fields, etc.), field labels containing these img tags can be translated, but field values cannot.  I'm also noticing other inconsistencies.  Should strings containing HTML not be used with t() or am I doing something else wrong?


texts: How to use Views PHP get Taxonomy field value and field collection value?

texts:
I am currently using Views PHP module to use Field Global PHP to render view value,
but I dont know how to read taxonomy field value and field collection value, did anyone know how to do it??

Beside, my field collection has three field, one is boolean and the other is taxonomy fields, did anyone also know how to extract the value??


texts: SQL error when adding an other database table

texts:
The Code:

In my module.install i am declaring my main database table. This works without any problems:

function my_module_install() {
  create_initial_roles();
  drupal_set_message("Installed module my_module.");
}

function my_module_schema() {
  $schema['my_module_foo'] = [
    'description' => 'Main table for my_module.',
    'fields' => [
      'id' => [
        'description' => 'The ID of the database entry of foo.',
        'type' => 'serial',
      ],
      // Many more fields ...
    ],
     'primary key' => ['id'],
  ];
  // Second table goes here (see code below).
  return $schema;
}

But as soon as i'm adding a second table, i am getting a SQL error:

// Inserted in shema function (see comment above).
$schema['my_module_bar'] = [
    'description' => 'Secondary table for my_module.',
    'fields' => [
      'id' => [
        'description' => 'The ID of the database entry of bar.',
        'type' => 'serial',
      ],
      // Possibly more fields.
      'primary key' => ['id'],
    ],
  ];

The Error:

The error occurs when installing the module:

PDOException: SQLSTATE[42000]: Syntax error or access violation: 1064 You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'DEFAULT NULL ) ENGINE = InnoDB DEFAULT CHARACTER SET utf8 COMMENT 'Main table fo' at line 3: CREATE TABLE {my_module_bar} ( id INT auto_increment DEFAULT NULL COMMENT 'The ID of the database entry of the bar.', primary key DEFAULT NULL ) ENGINE = InnoDB DEFAULT CHARACTER SET utf8 COMMENT 'Main table for my_module.'; Array ( ) in db_create_table() (line 2776 of C:\xampp\htdocs\drupal\includes\database\database.inc).

It looks like it is a problem with the character set (utf8) but it is a bit weird, that this error does not occur with only my main database table.


texts: change fields in content type after creation

texts: I know you "can't" do this, but hoping there might be a way.. Editing the database directly could work if I knew exactly what needed to be edited. Basically I want to change a file type to image because as fileI cannot enforce dimensions (this is on a site that was converted from drupal 6 to drupal 7 and already has a fair bit of data)


texts: Custom pager "Showing X - Y of Z results"

texts:
I have some entities queried from an external solr server using custom code and Search API, and I'm listing them 10 per page.

I have created a pager for the page using pager_default_initialize() and theme('pager').

I wanted to insert a text into the pager div that says "Showing X - Y of Z results". I can do this manually by overriding the theme_pager() function, but I was wondering is there a drupal native function or some setting which you can pass to theme_pager that does this?

I suppose in short I want the Views 3 equivalent of "Full pager", instead at the moment I'm only able to produce the "Mini" pager.


texts: How can I translate the name of a vocabulary?

texts:
I am looking for a solution through which Vocabulary name can be translated.
I'm using the i18n module with latest D7.

Currently I have chosen the option like so:

  Translate. Different terms will be allowed for each language and they
  can be translated.

Here is a screenshot to illustrate that option:

I am able to translate terms of this vocabulary as shown in the screenshot below:

Problem Statement: How can I translate the vocabulary name, i.e. "Test Vocabulary English" in my example above.


texts: Disable user language setting in user-edit page

texts:
I want to unset this specific part of the settings form in template php. I found some code example for Drupal 6, but can't figure out how to do it in Drupal 7.

I tried this without result:

if ($form_id == 'user_profile_form') {
  unset($form['language']);
}

(There is a module "user tweaks" but I want it to do it in the preprocess)


texts: Ubercart most selling product in drupal 7

texts: I'm using Drupal 7 on my site with Ubercart 7.x - 3.4. I want is an existing module or a view customization tips to make the most selling / best selling product.


texts: How do I prevent accessing a page with /node/37 directly when an alias has been set?

texts:
I work with Drupal 8.

I've set an url alias for my page to /nice-url.
When I acces it via http://mypage.com/nice-url everything works fine.

The problem is, this page is still accessable via http://mypage.com/node/37 - it's bad for SEO and it produces some mess.

Is it possible to remove that http://mypage.com/node/37 page? I mean I want the content of that page to accessable only via http://mypage.com/nice-url.


texts: Is there a template for the comment links field?

texts:
I want to use ajax-links-api so that when someone replies to a comment,
the url comment/reply/60/51 is loaded with ajax on the current page.
I need to add rel="a class" on the reply link's anchor, to select witch div to load.

Display suite adds a manage display for comments
Is there a template file I can use to change the html for the comments field "links"?

Update
By Installing Devel and adding the block I see the comment wrapper Devel
The template in modules/comment/comment.tpl does not look to have the html for links in it.Comment Template


texts: Update Entity Reference field programmatically

texts:
I'm kind of new to Drupal development and I'm a little lost on something I'm trying to do:

My company has several locations and I am developing a method whereby each location can have their own page on my company's website.

I want location managers to be able to log in and post news articles about their respective locations and have those articles appear on the appropriate location page.

I have content types set up for 'Location' and 'Site Articles'.  'Site Articles' has a 'Location' field that is a reference type back to Location.

In an effort to restrict the ability of various site managers to select a location that is not theirs, I am using hook_form_alter() to adjust the 'Location' entity reference in the 'Site Article' content type that reads what Site a manager belongs to in their User Account Settings, and adjusts the form so that ONLY the managers site shows up.  That code looks like this:

function smg_site_articles_form_alter(&$form, &$form_state){
global $user;
$account = user_load($user->uid);
if(!empty($form['field_site_news_article_location'])){
     $entity_node = node_load($account->field_user_location['und'][0]['target_id']);
     $form['field_site_news_article_location'] = array(
      '#title' => 'location',
      '#type' => 'select',
      '#options' => array(
          0 => t($entity_node->title)
        ),
      '#default_value' => $entity_node->title);

The problem that I'm running into is when I save the Article, the "Location" entity reference does not get populated and I can't add Views filters to it the way that I want.

I'm assuming the problem lies with how I'm altering the 'Location' entity refernce field in hook_form_alter(), but I'm a little lost as to how I get the data updated correctly.

Can anyone help??


texts: Testing a function which save some configuration - error called set on null

texts:
I have a function which does 2-3 things, one of the activity is to save the configuration.

function processProps($data) {
  $config = $this->configFactory->getEditable('mymodule.settings');
  $config
    ->set('some_setting', 'some value')
    ->set('another_setting', 'another value')
    ->save();
  ...
  return TRUE;
}

The test code as follows

public function testSspProcessProperties() {
    $data = $this->getTestData();

    $immutable_config_object = $this->prophesize(ImmutableConfig::class);
    $immutable_config_object->isNew()->willReturn(FALSE);

    $config_object = $this->prophesize(Config::class);
    $config_object
      ->setData([
        'key' => 'value',
      ])
      ->shouldBeCalled();
    $config_object->save(FALSE)->shouldBeCalled();
    $config_object->get()->willReturn([]);

    $this->configFactory->loadMultiple(['mymodule.settings'])
      ->willReturn([]);
    $this->configFactory
      ->get('mymodule.settings')
      ->willReturn($immutable_config_object->reveal());

    $this->configFactory->getEditable('mymodule.settings')
      ->willReturn($config_object->reveal());

    $this->assertTrue($this->myclass->processProps($data));
  }

This test gives error Error: Call to a member function set() on null.
When I debug found that $config object is loaded properly. So not able to understand why I say null :(

I checked ConfigEntityStorageTest for the reference.


texts: New node created on one site automatically created on others?

texts: Say I have a parent site where all my content is created: nodes and taxonomy terms, but I want that same content to be created - or to appear at least - automatically on multiple child sites. What ways could this functionality be achieved? The solution could be a custom module or a a contrib module, if one exists to perform this task.


texts: How to display an image when hovering over its title in a View?

texts:
In my style sheet (which does seem to be loaded), I have

.snhover_img a { position:relative; }
.snhover_img a span { position:absolute; display:none; z-index:99; }
.snhover_img a:hover span {
    display: block;
    width: 350px;
}

And in the Title field of my View, I have Rewrite results as

      {{ title }}

But I always see both the title and the image. Nothing happens on hover.
The debugger shows. What am I doing wrong?

Note: I am thinking that the style sheet is not really loading. If not, how do I fix that?


texts: Statistics module doesn't update when getting a node

texts:
I've created a custom module, which should regarding some other posts help updating the daycount. But it just doesn't get updated.

function services_statistics_improved_services_request_postprocess_alter($controller, $args, &$result) {
      // Increment hit count for node view api requests.
      if($controller['callback'] == '_node_resource_retrieve') {
        $nid = $result->nid; // May need to confirm this is the node id.
        dpm($controller);
        // See statistics_exit()
        if (variable_get('statistics_count_content_views', 0)) {
          // A node has been requested, so update the node's counters.
          db_merge('node_counter')->key(array('nid' => $nid))->fields(array(
            'daycount' => 1,
            'totalcount' => 1,
            'weekcount' => 1,
            'monthcount' => 1,
            'yearcount' => 1,
            'timestamp' => REQUEST_TIME,
          ))
          ->expression('daycount', 'daycount + 1')
          ->expression('totalcount', 'totalcount + 1')
          ->expression('weekcount', 'weekcount + 1')
          ->expression('monthcount', 'monthcount + 1')
          ->expression('yearcount', 'yearcount + 1')
          ->execute();
        }
      }
    }

Anyone able to help me out here?


texts:
I have a Drupal 7 with several basic pages with repeated paths, for example:

1) /red-car/ford-and-chevy
2) /red-car/nissan-sport
3) /red-car /renault-mazda
4) /blue-house/mexico
5) /blue-house/colombia
6) /blue-house/el-salvador

How can I add a file red-car.css for "/red-car/" and blue-house.css for
  "/blue-house/" from template.php?


texts:
I'm working with services 7.x-3.12, I need to create a web service in order to get a kind of "associative request" between : books(table stored in db) and categories(another table) those two tables are linked by entity_id

I can GET books (retreive, index) same for categories, but how to get Book A -> categorie A ? or the book list of category A

How can I make it work (the get service)?
P.S. book is a content type (node), categories are taxonomy(taxonomy_term)


texts: If taxonomy vocabulary changes from Translate to Localize how to combine terms?

texts:
My d7 is using i18n, internationalization taxonomy. I have vocabulary that have option Translate. So it looks like (eng, de):
Creative
- Projects
- Portfolio
Kreativ (de)
- Projekte (de)
- Portfolio (de)

These terms have relations between one and other. Really I have about 150 terms and  want to simplify this vocabulary. Need to change it to Localize option. If I will check Localize all terms beacame independent (single) so this is very very bad.
How to combine all of them, please?


texts:
The FAPI documentation gives the following instruction and example:

  checkboxes

  Description: Format a set of checkboxes. #options is an associative
  array, where the key is the #return_value of the checkbox and the
  value is displayed. The #options array cannot have a 0 key, as it
  would not be possible to discern checked and unchecked states.

$form['high_school']['tests_taken'] = array(
  '#type' => 'checkboxes',
  '#options' => drupal_map_assoc(array(t('SAT'), t('ACT'))),
  '#title' => t('What standardized tests did you take?'),
  ...
),

I have the following element in my form constructor:

'audio_options' => array(
  '#type' => 'checkboxes',
  '#title' => t('Options'),
  '#options' => drupal_map_assoc(array(
    t('Controls'),
    t('Autoplay'),
    t('Loop'),
    t('Buffer'),
  )),
  '#attributes' => array('class' => array('container-inline')),
),

and the following in my submit handler:

$node->field_audio_options[LANGUAGE_NONE] = $form_state['values']['audio_options'];

On submission the error thrown is:

  PDOException: SQLSTATE[HY000]: General error: 1366 Incorrect integer
  value: 'Controls' for column 'delta' at row 1

Why does the documentation say that you can use a string as the options key, when presumably it is saved in the delta column of the field's table, which requires an integer?

What is the correct way to save checkboxes values on form submission?

Thanks.


texts: I have multiple profiles using profile 2 per user need to create view showing data from 2 profiles but only one line per user

texts:
Ok, I am creating a website for a volunteer agency which will have each member of the agency having their own log in to our site and a set of profiles made based upon important key data based upon the specific profile within their user acct.

The Profiles I have so far are

User - Default USER profile in Drupal

Roster Information (Roster)
Training Information (Training)
Driving Certifications Information (Driver)

What I am needing is to create a view that shows the following

User Name (User)  | ID # (Roster) | Name (Roster) | Truck 1 (Driver)| Truck 2 (Driver)

with one line per user what I am getting is

Username (User) | ID # (Roster) | Name (Roster)
Username (User) |                                 | Truck 1 (Driver)| Truck 2 (Driver)

Can someone assist in creating this view in such a way as each user has only one line based upon the PID located within the Profiles2 data for the 2 profiles referenced and linked with the users UID under the default drupal profile?


texts: How to get total number of results in Search API View?

texts:
How can I get the total number of results on a Search API View that has a limit of 5 results to display?

Some more info:
I have to make a bit more complex search where several attachments are combined on a page as a groups of results. Every group should show just the first 5 results, but also a link "see all XX results". I'm using Search API + Solr, Views with exposed fulltext search.
If I use "Global: Results summary" in header or footer, it will show maximum the limit of 5 as a number.

edit 1

Search API Solr returns 'numFound' which is what I need, but how do I use it in Views?


texts: Why does d7_user_role need a db connection configured when migration group already defines it

texts:
I've just done a super basic user_role import and I'm trying to do a user import. Both are in the same migration group and the migration group has a souce key to specify which database listed in settings.php to use.

I can migrate and roll back the user_role import fine, but as soon as I try to import the users, I get "Migration mysite_user did not meet the requirements. No database connection configured for source plugin d7_user_role"

migrate_plus.migration_group.basic_migration.yml

uuid: 512c4248-7f60-4b08-9cc2-8d804657262c
langcode: en
status: true
dependencies: {  }
id: basic_migration
label: basic_migration
description: 'basic migrations'
source_type: 'Drupal 7'
module: null
shared_configuration:
  source:
    key: legacy

migrate_plus.migration.mysite_role.yml

uuid: 6e288181-f2fd-4e22-885e-02282cc4d222
langcode: en
status: true
dependencies: {  }
id: mysite_role
class: null
field_plugin_method: null
cck_plugin_method: null
migration_tags:
  - 'Drupal 7'
  - Configuration
migration_group: basic_migration
label: 'Mysite Role'
source:
  plugin: d7_user_role
process:
  id:
    -
      plugin: machine_name
      source: name
    -
      plugin: user_update_8002
  label: name
  permissions:
    -
      plugin: static_map
      source: permissions
      bypass: true
      map:
        'use PHP for block visibility': 'use PHP for settings'
        'administer site-wide contact form': 'administer contact forms'
        'post comments without approval': 'skip comment approval'
        'edit own blog entries': 'edit own blog content'
        'edit any blog entry': 'edit any blog content'
        'delete own blog entries': 'delete own blog content'
        'delete any blog entry': 'delete any blog content'
        'create forum topics': 'create forum content'
        'delete any forum topic': 'delete any forum content'
        'delete own forum topics': 'delete own forum content'
        'edit any forum topic': 'edit any forum content'
        'edit own forum topics': 'edit own forum content'
    -
      plugin: flatten
  weight: weight
destination:
  plugin: 'entity:user_role'
migration_dependencies: null

migrate_plus.migration.mysite_user.yml

uuid: bd0ef271-9c8f-40d7-9b65-8147e4cdda47
langcode: en
status: true
dependencies: {  }
id: mysite_user
class: Drupal\user\Plugin\migrate\User
field_plugin_method: null
cck_plugin_method: null
migration_tags:
  - 'Drupal 7'
  - Content
migration_group: basic_migration
label: 'Mysite User'
source:
  plugin: d7_user
process:
  uid: uid
  name: name
  pass: pass
  mail: mail
  created: created
  access: access
  login: login
  status: status
  timezone: timezone
  langcode:
    plugin: user_langcode
    source: language
    fallback_to_site_default: false
  preferred_langcode:
    plugin: user_langcode
    source: language
    fallback_to_site_default: true
  preferred_admin_langcode:
    plugin: user_langcode
    source: language
    fallback_to_site_default: true
  init: init
  roles:
    plugin: migration_lookup
    migration: d7_user_role
    source: roles
  user_picture:
    -
      plugin: default_value
      source: picture
      default_value: null
    -
      plugin: migration_lookup
      migration: d7_file
destination:
  plugin: 'entity:user'
migration_dependencies:
  required:
    - d7_user_role
    - mysite_role
  optional:
    - d7_field_instance
    - d7_file
    - language
    - default_language
    - user_picture_field_instance
    - user_picture_entity_display
    - user_picture_entity_form_display

Any pointers where to start looking would be much appreciated.


texts:
I am working on a music site with a couple other programmers who have left.

We are using taxonomy terms or "tags" for each node, to determine the url/subdomain the node will be shown, on effectively creating different subdomains of content.

There is only one debug statement in the code, and even if there was another hiding somewhere, it does not explain why it shows two different arrays from the same taxonomy on the homepage.

I use the following code to reveal what terms are associated with the node:

 $terms = array();

 foreach($node->taxonomy as $term) {
   $terms[$term->name] = $term->name;
 }

 print 'debug:
' . check_plain(print_r($terms , 1)) . '
';

I get the following output:

    debug:
    Array
    (
        [national] => national
        [nyc] => nyc
    )
    debug:
    Array
    (
        [national] => national
        [nyc] => nyc
    )

Why is it showing 2 groups of arrays from the same taxonomy? The posts are only tagged once with these two tags "national" and "nyc."

Also on any nodes tagged with only "national," "washington" shows up as well in the duplicate array. I think it may be coming from another content type because when I performed a redirect on the node, using

unset($terms['national']);
      $value = array_shift($terms) ;
      if($region != $value) {
        $link = 'http://' . $value . '.thedelimagazine.com/' . drupal_get_path_alias("node/$node->nid", $path_language = '');
        drupal_goto($link, $query = NULL, $fragment = NULL, $http_response_code = 301);

it redirected to a different content type "CD of The Month." using term "washington" it should choose the other term in the first array; in the case above "nyc."  and go to the same node type in this case "blog,"  I performed this redirect using drupal_get_path_alias for other logic cases and it worked fine.

debug:
Array
(
    [national] => national
)
debug:
Array
(
    [national] => national
    [washington] => washington
)

The debug is called inside this function

function region_filter_nodeapi(&$node, $op, $a3 = NULL, $a4 = NULL) {
  /*global $user, $base_url;*/
  switch ($op) {

    case 'view':

      if( (arg(1) == 0)){ }

      else {

The site is http://www.thedelimagazine.com.


texts: How to display all taxonomy terms as links and point them to nid in views

texts:
I created a taxonomy vocabulary and terms.

I created a content type with the taxonomy.

I added contents.

I would like to create a views block that will display all the taxonomy terms as links as well as each link should point to its NID.

For my views block:

I selected the taxonomy field.

I selected "Rendered taxonomy terms" in Formatter.

Click the Taxonomy field.

Selected output this field as link.

Entered node/[nid] as links path.

It did not work.  Also, links are not pointed to NID. Can you please help how to edit the views settings?

Views settings:


texts: Get Users by roles for organic groups drupal7

texts:
I have following system roles  set up for users

content publisher
content approver

All my users divided in to 5 organic groups.

I didn't set up any roles for organic groups.I am trying to get content approvers for particular group for approval process.

I tried using this function og_get_users_by_roles.

But the above function uses the organic group roles not system roles.

I am confused now should i setup same roles for organic groups.Please give some direction.


texts: Why does the download page recommend the previous version?

texts:
Why does Drupal download page recommend Drupal 7.x? I can hardly see the footprint about Drupal 8.

Does it mean Drupal 8 is still under development? Does it mean Drupal 7.x can be the last stable version?


texts: Calling ajax function from jquery on change event

texts:
Would appreciate help on a design strategy.

On a form I have an auto complete text field that I would like to populate with two separate values based on a radio button selection.

Currently the first radio button is loaded via an ajax call on load via hook_menu.

function hook_menu() {
$items = array();

$items['module/state_autocomplete'] = array(
        'page callback' => 'state_autocomplete',
        'access arguments' => array('create states'),
        'type' => MENU_CALLBACK,);

Can I attach an ajax call to an on change event that will reload the text field without reloading the page?

For example:


texts: How to create a drop down field to categorize content when creating new pages?

texts:
I want to have a drop down field available so that when a content author (user) creates a new page, they can select which section of the website this new content should get placed.

For example, my top navigation may be About Us > Services > Products. A user creates a new page that should go on in the Products section. When they go to add the new page, there should be a drop down field that shows About Us, Services, Products. The user would select Products and when they save the page, that page will automatically get placed in the Products section of the website.

Can anyone tell me how to achieve this?


texts: Filter three views blocks by the same filter

texts:
Is there a possibility to filter three separate views blocks by one filter form.

Basically the Idea is:

Filter:

Text field

Date field

Search button

And below we show

First views block
Upcoming

Second views block
Current

Third views block
Past

Whatever we select in the filter is affecting these three blocks. And there are corresponding orderings for each block.

Another complication:

Each block can have a grouping by type:

Example:

Upcoming:

type 1:

data 1

data 2

data 3

Type 2:

data 2

data 23

data 24

And the same is for Current and Past


texts: Unable to post new forum topics in Drupal site

texts:
When I try to post a new forum topic getting this error

Fatal error: Allowed memory size of 157286400 bytes exhausted (tried to allocate 91 bytes) in /sai/vij/modules/field/field.attach.inc on line 696

i have a free space of 4389 MB in server. and I given a memory_size as -1 in php.info file.

     Any ideas for implementing this in drupal is appreciated.


texts:
I finally was able to fix my site in our stage environment until I logged out of the admin section. Now the site has no css at all. All the html seem to be fine. If I login as admin, the site is still perfect.

I tried to clear cache, still same problem...

I tried to change the theme, the new theme has css. As soon as I get back to the original theme: no css as anonymous.

I looked at the source code and the includes are not there at all. So forget about a bad path.

I looked at my theme.info and it is fine.

What can possibly add  tags in the  while logged in as admin and not as anonymous?

Note: when there is no css, there is no javascript. So you could read this question and replace all "css" for "javascript"


texts: How to post Content with REST api by anonymous user

texts:
I have a content type that anonymous user can submit content, Now in a mobile application I want to let them submit content with REST API,

My snippet to submit :

(function($){

                    jQuery.ajax({
                        url: '/rest/session/token',
                        method: 'GET',
                        success: function (token, status, xhr) {
                            var postData = {}
                            postData.title = [{'value': 'My Basic Page'}];
                            postData.field_enroll_email = [{'value': 'yusef@gmail.com'}];
                            postData.type = 'enroll';
                            jQuery.ajax({
                                url: "/entity/node",
                                method: "POST",
                                data: JSON.stringify(postData),
                                headers: {"Accept": "application/json", "X-CSRF-Token": token, "Content-Type": "application/json"},
                                success: function (data, status, xhr) {
                                    console.log(data);
                                }
                            });
                        }
                    });
})(jQuery);

this work correctly in browser console when I'm logged in, and When I try it without login return "403 permission is denied". I set permission for anonymous user to create "mycontent1" content.
**I want to know how can   anonymous user post content with REST in Drupal? **


texts:
I am using the contrib contact module to add a contact form.

I created a category in /admin/structure/contact to add the recipient. I added my person address mail (It's valid).

When I test the form, Drupal returns a confirm notification to say that the mail is send successfully.. But the mail is not received.

In /admin/reports/dblog, any error is reported.

PS: I use in my site other functions to send mail and it's received.

Any idea please?

Thank you..


texts: Stay logged while switching between domains

texts:
I have two domains (domain1.com and domain2.com) for one drupal installation. In some occasions I switch between the two. When a logged in user does this he is not logged in anymore.

Search the internet I find some answers talking about a cookie domain. But this is always connected tot Drupal 7 and not Drupal 8. Is there a similar option I can use in my settings.php file to solve this problem?


texts: Service module costume response after creating node

texts:
I want to get costume return from services module after creating a node.
I would like to checks if the there is a similar title, and if so, to return the number of times it exists.
(Services 3 / Drupal 7)
What is the way to do this?


texts:
I'm trying to add the user edit form in a block.
I created a custom module

use Drupal\Core\Block\BlockBase;
use Drupal\user\ProfileForm;

class EditUserBlock extends BlockBase{

  /**
   * {@inheritdoc}
   */
  public function build() {

    $form = \Drupal::formBuilder()->getForm(ProfileForm::class, \Drupal::currentUser());

    return $form;
  }
}

but it doesn't render the form.

Sorry but I'm pretty new to D8.


texts: How to get GD2 generate PNG8 when resizing PNG8 images

texts:
I have an image field which accepts jpg, jpeg, png. I've chosen the Image style: Medium on the display of that field. That style is configured at /admin/config/media/image-styles/manage/medium and it simply scales the image to 600px width.

On /admin/config/media/image-toolkit I can see that GD2 is being used.

My problem is that if the original image on that field is PNG8, the rendered thumbnail (by GD2) is PNG24. This results in much larger file for no reason.

Shouldn't GD2 respect the fact that the source is PNG8? Is there a way to fix this?


texts: How to print all the elements of a specific column from a table from database in custom module?

texts:
I have a  custom module. I would like to see all the blocks in it . For that i have written a query in my costom.module file . But it will show me the following error.

Query:-

 $result = db_query('SELECT *FROM  `block` ORDER BY
`block`.`delta` ASC LIMIT 0 , 30');
 while ($node = db_fetch_object($result)) {
 print_r("$result");
 }

Why this is not working, Where am i going wrong ?


texts: How can I stop js script from running on mobile?

texts:
I need some help with a Zen subtheme using responsive-sidebars.css
I have some javascript that I only want to run if the screen is bigger than 480px.
The javascript is:

(function ($) {
        jQuery(document).ready(function(){
         $('#selllink').trigger("click");
       });
    })

I am not sure how I would restrict this.
Many Thanks
Julie


texts: How to create a renewal request from the subscription page?

texts:
I have 2 content types: a subscription and a renewal_request.

I would like to have the possibility for the user to create a renewal request from the subscription page (or from a view of subscriptions using VBO).

The renewal needs to be a content type, as there is a workflow associated to it (manual verification of user details).

What would be the best solution?
Create a link passing the nid of the subscription and use the Entityreference Prepopulate module? Or overriding the form?


texts: First item of contextual filter summary active

texts:
I created a view that displays a table of data (format: table).

I added a an attachment with a contextual filter. The filter is a summary list based on a field in the table.

The filter works, but I would like that when the view is loaded, only the data for the first item in the filter is loaded. So, based on the example below, when I load the page only Fall 2015 will load in the table and not Fall, Spring, and Summer.

Basically what I am trying to obtain is tabs, with the first tab active.
Is this possible? Thanks


texts:
I am new to Drush. How can I execute this script to remove comments of a specific user?

$uid = xx // the spam users id;
$query = db_query("SELECT cid FROM {comments} WHERE uid = %d", $uid);
while($cid = db_result($query)) {
  comment_delete($cid);
}

Also, that would be great if you could tell me how to complete the script so that it takes username instead of $uid.

Thanks


texts: When adding a new node with a date field in it, the date field is prepopulated with the current date. Is there a way to easily switch that feature off so that the date field is empty?


texts:
I have a blog, I am developing and using the following plugins, but I am not committed to them and will change to get the behavior I want.

TinyMCE
Wysiwyg
Colorbox
Media

In many blogs I see inline images that are small and when they clicked on then expanded in a colorbox.

I am curious how to achieve this using drupal 7 and uploading images using the media module?


texts: How to get the path to the translated node?

texts:
I've set up a multilanguage site in Drupal 7. In a template I need to add a link to a specific content node. This node has translations and path aliases like so:

node/42 = pathalias_de (german version)
node/43 = pathalias_en (english version)

In the template I'd like to call url() to get the link to the aliased version of the content node in the current language.

On the german page it should link to /de/pathalias_de on the english page to /en/pathalias_en

I've tried several variations, like calling the nid, calling the alias, passing the current language object to url().

Is this something url() should be able to do or do I need a different function? Thanks!


texts: Drupal Apache solr does not return "no results founds"

texts: I'm using Apache Solr 7.x-1.1 with Drupal. It was working fine but something happened and when I search for dummy data that I'm sure that is not found in my site, the search result will be all nodes in my site instead of returning "your search yielded no results". It was working perfect before but I don't know what I did so this occurred.


texts: module to customization product in drupal commerce

texts:
Is there any module to let my shop customers design their own t-shirt, mugs, caps, mouse pads. They can upload an image to t-shirt, back and front side, or select existing image from the logo categories, and they can also write their text on the template shirt.
and have below features

Features:

Upload an image on the template t-shirt.
List item
Change t-shirt side, front or back.
Select an Image from the existing logo categories, to put on the
template t-shirt
Write text on the template t-shirt
Up to 4 text lines - New
Change text size, color, font type

my shop is based on drupal commerce

anybody know  module to provide something like this features, or any idea that how can I implement it?


texts: How to obtain "found xx results in the category X "?

texts:
I 've got many exposed filters into a view : all I want to do is to show the total number of item per categories that I obtain from a research.
I mean something like this: I have items organized into categories and sub-categories. When I apply a filter, I want this description at the begin of the result list:

i.e.

We have found n°45 items into category "X", subcategory "Y"

where "X" is the main category and "Y" the subcategory , selected in the filter for the research.

I know in Views3 I can show the number of the results by setting "Global:result summary" in the head, but since I want to show the category and the subcategory where the items where found, I think it should be better to insert all this instructions by a code ...

I found following code in order to show the number of results for research of 1 or more records :

<?php
  $view = views_get_current_view();
$count = ( $view->total_rows );
if (count($view->exposed_input))
print "$count results per categories";
?>

How can I modify this code in order to show also the category and subcategory from which the results belong ?

Thank you for your help!

Ciao


texts: How to remove the extra loading icon in my custom Drupal form?

texts:
I have created a custom form using (Drupal form API). It has email field as autocomplete.

//implements hook_menu
function mymodule_hook_menu() {

$items['add-form'] = array(
                'title' => 'Submit request to add chapter.',
                'description' => 'Submit request to add chapter.',
                'page callback' => 'drupal_get_form',
                'page arguments' => array(
                        'my_form'
                ) ,
                'access callback' => TRUE,
        );

$items['my/email/autocomplete'] = array(
                'page callback' => '_my_email_autocomplete',
                'access callback' => TRUE,
                'type' => MENU_CALLBACK
        );
        return $items;
}

function my_form($form, &$form_submit)
{
        $form['email'] = array(
                '#title' => 'email',
                '#type' => 'textfield',
                '#required' => TRUE,
                '#size' => 50,
                '#description' => t('Enter your valid email'),
                '#autocomplete_path' => 'my/email/autocomplete',
                '#attributes' => array(
                       'placeholder' => t('example@example.com')
                )
        );
        $form['submit'] = array(
                '#type' => 'submit',
                '#value' => 'Submit'
        );
        return $form;
}

function _my_email_autocomplete($string) {

  $matches = array();
  // Some fantasy DB table which holds cities
  $query = db_select('my_table', 'a');

  // Select rows that match the string
  $return = $query
    ->fields('a', array('email'))
    ->condition('a.email', '%' . db_like($string) . '%', 'LIKE')
    ->range(0, 10)
    ->execute();

  // add matches to $matches
  foreach ($return as $row) {
    $matches[$row->email] = check_plain($row->email);
  }
  // return for JS
  drupal_json_output($matches);
}

For some reason there are two loading icon in the email field, as shown in the screenprint below:

The upper icon is the default one, which seems to work fine but the icon below the default one continues spinning for no reason.

I tried clearing cache but not able to remove this.

Any suggestions about how to get this remmoved?


texts: How to redirect Add to Cart link to product page?

texts: I am working with E-Commerce module of Drupal 7. I want to redirect Add to Cart button link to product page only those products which have attribute otherwise I want to add product direct to cart.


texts: Send a message or notification to other user within the site

texts: I'm using Drupal 7 on a production site and I want users to be notified by email and if they are on the site at the time, in a message window that they have been awarded points or other notifications. I already know how to do the email part, I just use the rules module to accomplish this. But I'm at a lost about how to do this with messaging, I tried using rules to create a site message but the message is only visible to the user that "granted" the points not the "recipient".


texts: How can I prepopulate a field's value when creating a new entity

texts:
I have a custom entity (foo) which contains an entity reference field to another custom entity (bar). I would like to create a URL on the bar's unique page to create a new foo entity, where the entity reference is pre-populated with the correct target_id.

For example, a link to /admin/structure/my_module/foo/add?target_id=2501

Is this feature already available? Can I add something to the entity buildForm method to prepopulate my value?

class FooForm extends ContentEntityForm {
  public function buildForm(array $form, FormStateInterface $form_state) {
    //SOMETHING LIKE THIS?
    //if (isset(REQUEST::get('target_id'))) {
    //  $form_state['edit-bar-id-0-target-id'] = REQUEST::get('target_id');
    //}
    /* @var $entity \Drupal\my_module\Entity\Foo */
    $form = parent::buildForm($form, $form_state);
    $entity = $this->entity;
    return $form;
  }
}

I'm not familiar enough with the structure of the $form_state or best practices on get() to be comfortable testing this.


texts: Search API Index fields getting unselected

texts:
I am using Search API to define search pages and facets and I connect to a Solr engine. My search has been working perfectly until recently, after my last documents have been indexed. Now, every so often, two of my full-text fields on the "Fields" tab of the index configuration page just become unselected. Both fields are long text. This happens at least once a day. I then get no search results back and I have to go to the index's field selection tab (admin/config/search/search_api/index/my_search/fields), select them again, and click "Save". The search results are then available immediately (i.e. it doesn't have to re-index first).

What is also worrying (actually more worrying), is that sometimes when this happens, the fields aren't even available to be selected AT ALL! When this happens, I have to clean the index completely using drush and then they become available again. Then I have to re-index all of my documents (about 8 million), which takes a whole day.

This site is live, so I am desperate. Please help!


texts: Filters on optional relationships that to not hide the main row

texts:
As an example, imagine a game where each person can have 0+ marbles, each of which are entities. How could I create a list with each person, along with any blue (not any other colors, possibly creating multiple rows per person if they have more than one) marbles they have, still displaying them even if they don't have any. I'm thinking I would use an optional relationship, but if I put a filter, it completely hides the row if it has a match that doesn't meet the filter instead of treating it as if the relationship had no match at all.

Note: In the actual site, the "People" are ECK entities, and the "Marbles" are nodes with entity references to the "People".

EDIT: This is not a dup of Views and joining content types on specific field in Drupal 7 as that discusses how to create an required relationship in Views, whereas this one is about filters on optional relationships.


texts: Using triggers to add new user to a mailing list

texts:
I would like the Mailman Integration module to add any new user to a mailing list. I enabled Triggers and created an action in PHP. I then assigned the action to execute when a new user is created. I can not figure out how to get the $user object for this new user though. I can get the object of myself, the logged in user using global $user, but how do I get the new user?

$user = [newly added user];
$mail = $user->mail;
$name = $user->name;
$uid = $user->uid;
$list_name = 'list';
mailman_integration_subscribe($list_name, $mail);
mailman_integration_set_user_option($list_name, $mail, 'fullname', $name);
mailman_integration_insert_users($list_name, $mail, 0, $uid);


texts: How to access jQuery plugin added through libraries API

texts:
I'm working on a Drupal 7 module to integrate an existing jQuery plugin (smallworld.js). I've added it successfully through the Libraries 2.x API in my module:

$libraries['smallworld.js'] = array(
    'name' => 'SmallWorld.js',
    'vendor url' => 'http://mikefowler.me/smallworld.js/',
    'download url' => 'https://github.com/mikefowler/smallworld.js',
    'version' => '1.0', //no version actually defined in code
    'files' => array(
      'js' => array('src/smallworld.js'),
      'js' => array('src/smallworld.jquery.js'),
    ),
  );

and have confirmed that the files are loading correctly. However, when I try and access the file in my Drupal jQuery, ex:

(function ($) {

  Drupal.behaviors.smallworld = {
    attach: function (context, settings) {
      $.getJSON('/sites/all/libraries/smallworld.js/dist/world.json', function (data) {
        $('.map').smallworld({
          geojson: data,
        });
      });
    }
  };
}(jQuery));

It doesn't trigger, giving me the console error message "Smallworld is not a constructer."

The two files it is loading are the Smallworld library and a smaller jquery wrapper that registers the library as a jquery plugin:

  $.extend($.fn, {
    smallworld: function (options) {
      var opts = $.extend({}, $.fn.smallworld.defaults, options);
      return this.each(function () {
        $(this).data('smallworld', new Smallworld(this, opts));
        return this;
      });
    }
  });

Does this wrapper also needed to be added to the same Drupal jquery namespace? If a jquery library is added through Libraries API, is there special namespacing to consider when accessing it?


texts:
I have written a custom validation handler for webform that compares two fields.  If the fields are in a container/fieldset/etc., I would like to set the error on the container instead of on the fields (since either of the two fields could be the erroneous field).  For example, the fieldset is trip-dates, the fields are start-date and end-date and I want an error if start-date is after end-date.

I can use setErrorByName/setError to set errors on individual fields, but it doesn't work if I try to set an error on the fieldset.  When called against a fieldset, setErrorByName/setError call sets the error message at the top of the form, but does nothing to highlight/set an error class on the fieldset.

Webform Source:

event_details:
  '#type': fieldset
  '#title': 'Event Details'
  '#attributes':
     name: event-details
  date_container:
    '#type': fieldset
    '#title': 'Travel Dates'
    '#required': true
    '#attributes':
       name: date-container
     departure_date:
       '#type': date
       '#title': 'Departure Date'
       '#required': true
       '#default_value': '+1 day'
       '#format': short
       '#date_date_min': today
       '#datepicker': true
       '#datepicker_button': true
       '#date_date_format': m/d/Y
     return_date:
       '#type': date
       '#title': 'Return Date'
       '#required': true
       '#default_value': '+1 day'
       '#format': short
       '#date_date_min': today
       '#datepicker': true
       '#datepicker_button': true
       '#date_date_format': m/d/Y

Class Code:

  $errorFields=[
     'date_container',  //sets message, fails to highlight
     'date-container',  //sets message, fails to highlight
     'event_details][date_container',   //sets message, fails to highlight
     'event-details][date-container',   //sets message, fails to highlight
     'return-date',     //sets message, fails to highlight, as expected
     'departure-date',  //sets message, fails to highlight, as expected
     'return_date',     //sets message, highlights single field as expected
     'departure_date',  //sets message, highlights single field as expected
  ];
  foreach($errorsField as $errorField){
    if (!($left_val <= $right_val)) {
      $formState->setErrorByName(
       $errorField,
      $this->t('some weird message'));
    }
  }

I have also tried changing the names of the containers to underscores instead of dashes...no luck.  If it would just add an error class to the fieldset, I could style it easily enough, but it doesn't seem to change anything about the fieldset.

I have also tried container, details and section instead of fieldset.


texts:
I am racking my brain trying to figure out how to create a conditional statement in Drupal concerning the "Authored By" field.

Right now, I have a special node template for a content type in my Drupal installation. I need to be able to define in that template when the "Authored By" field is filled in to display JUST the author full name but if it is not filled in, to display NOTHING.

I don't know I am having such a hard time accomplishing something so seemingly elementary, but any help would be greatly appreciated!


texts: Using Rules to Schedule Publishing/Unpublishing of Content

texts:
I have a Triggered Rule that is fired on "Content is going to be saved". What it should do is look at the content type, and if that passes, delete any scheduled task based on that node ID, and schedule the "Publish Ruleset".

The "Publish Ruleset" then is fired, which calls a Schedule Expire Node rule, and Schedule Node Publish rule. The first one schedules another task based on an Expiration CCK Date field, the second publishes the node based on a Publish CCK Date field.

Anytime these rules are fired, any other scheduled tasks with the same node ID are deleted.

Some times nodes are published when they should be, some times they are not, and they don't seem to be unpublished with consistency either.

Is it too specific to have the CCK Date fields using time as well as date for the rule? Should it just be a date without specifying time?

I am having trouble figuring out if this is the correct way to automate the publishing and unpublishing of content with Rules.

I modelled the Rule after this tutorial:

http://drupal.org/node/520012

What I am seeing is sometimes the tasks are scheduled correctly, and the nodes in question are published (or unpublished). The queue never seems to clear itself though. Does Rules know that it can't publish something that is already published, or does it evaluate everything in the queue anyway?

Has anyone found a good way to handle this?


texts: How to only change part of a form element parent list

texts:
I'm making a form element with '#tree' => TRUE. I have no idea where this element will be used and so I have no idea what it's list of parents will look like. I leave '#parents' undefined:

$elements['foo'] = array(
  '#tree' => TRUE,
  // Some more keys
);

If I don't define '#parents' on this item it will be added automatically because of the '#tree' => TRUE, and become something like this:

'#parents' => array('some', 'unknown', 'parents', 'foo')

I then add an element further down in the tree structure:

$elements['foo']['bar']['baz'] = array(
  // Keys here
);

If I don't define '#parents' on this subelement, it will be:

'#parents' => array('some', 'unknown', 'parents', 'foo', 'bar', 'baz')

But what if I want it to be this:

'#parents' => array('some', 'unknown', 'parents', 'foo', 'baz')

I can't set

$elements['foo']['bar']['baz']['#parents'] = array('foo', 'baz');

because then it will lose the unknown parents. So how do I do this?


texts: The website I'm building has a lot of content that I do not want linkable to the actual node. Is there a way to remove the link in the content headers?


texts: Is there a way to manage public API documentation?

texts:
I have created a custom module for my site that includes a public REST API.  We've also written public documentation for the API.  It's currently written in Markdown for convenience and easy export.  We maintain the documentation in version control so that it stays up-to-date along with changes to the endpoint in the module itself.

We would like to publish this documentation to the site in a way that is publicly accessible.  I've found documentation on hook_help but that seems to be targeted towards site admins (e.g. documenting settings for the module). Instead, we're looking to document the API endpoint for an end user.  We know we could simply create Page content to hold the documentation but we were looking for something more automatic when the module code is updated.

Is hook_help still the right way to add this content to the site? Is there a way to make only portions of the Help section public? Or is there another way to publish API documentation as part of the module?

We are currently on Drupal 7 if it is relevant.

EDIT:

Additional Info:

We are using the Services module to manage the API endpoint(s)
We are less looking for documentation generation and more looking for a way to publish the documentation that we have already written in a way that it is updated automatically when the module is updated. We maintain our documentation in version control so that it is updated as part of development. By doing it manually, it is more comprehensive and directly useful than generated documentation (IMO). We would just like the work done during development to be displayed publicly without having to do the extra step of copy-pasting to a Page (a step which is easily forgotten).


texts: Commerce Fee not being added to order total sent to payment processor

texts:
I have followed the Commerce Fees module's instructions found at https://www.drupal.org/project/commerce_fees:

DOCUMENTATION

    Go to admin/commerce/config/fees and add a new fee type
    Add a rule at admin/config/workflow/rules
        Event: "Apply a fee to a given order".
        Set the conditions.
        Action: "Apply a fee to an order".
            Entity data selector: "commerce-order".
            Fee: Your fee type.
            Set amounts, currency and taxes as necessary.

Notice: if using fees based on payment type, be sure to move the payment type pane to a screen before the review pane on admin/commerce/config/checkout so that customers can see the fee before accepting.

The Fee shows up in the cart contents on checkout but that fee is not added to the order total that is sent to the payment processor not show in the orders view. It's like the fee is not actually added to the total, except for in the cart content view on the checkout page.

Any idea of what I am missing?


texts: Is there a way to use $front_page in node.tpl?

texts: I'm aware that $front_page is a variable used in page.tpl, but is there a way to use it (or something similar other than a direct link) to print the index url in a node.tpl?


texts: How do I configure the Services OAuth sub-module?

texts:
The Services module is about to release its new 3.0 version for both D6 & D7.
There's an OAuth sub-module to Services that adds a new OAuth UI within the Services configuration UI.

Does anyone know how to configure that UI?

I'm expecting the Services developers will write something up, but given that they are working hard on the official release, the documentation will be the last thing done. In the mean time, if anyone has figured it out from prior familiarity with OAuth, please share your knowledge to us less informed. (As in explaining it to someone who has not used OAuth before.)


texts: Ajaxified form in modal window does not dimiss

texts:
I have form in modal window with two selects. Second field hidden and appears with ajax after first field selected.

If i click Submit when first select is not defined and second is
hidden - modal window dismisses;
If i click Submit when first select
    defined and second is visible (i.e. form was refreshed with ajax),
    instead of modal dismiss i see raw output in browser:

  [{"command":"settings","settings":{"basePath":"/","pathPrefix":"","ajaxPageState":{"theme":"opie","theme_token":"5OSo2MbF_rbvJauMUEumH0Mm-gFubWX6Ai-FqvwO9lo"},"fancybox":{"options":{"padding":0,"scrolling":"visible","nextClick":1},"helpers":{"overlay":{"fixed":0}},"selectors":["a[rel=\u0022fancybox\u0022]","a.fancybox","img[rel=\u0022fancybox\u0022]",".gallery-frame
  a"]}},"merge":true},{"command":"modal_dismiss"}]

Can you help me to understand why is that?

Main code:

function modal_callback($mode = NULL) {
    if ($mode == 'ajax') {
        ctools_include('ajax'); ctools_include('modal');
        $form_state = array('ajax' => TRUE, 'title' => 'Title');

        $output = ctools_modal_form_wrapper('stage_form', $form_state);
        if (!empty($form_state['ajax_commands'])) $output = $form_state['ajax_commands'];

        print ajax_render($output); drupal_exit();
    }
    else return drupal_get_form('stage_form');
}

function stage_form($form, $form_state) {
    $form['#prefix'] = '
';
    $form['#suffix'] = '
';
    $form['start'] = array(
        '#type' => 'select',
        '#options' => array('1'=>'1', '2'=>'2'),
        '#ajax' => array(
            'callback' => 'form_refresh',
            'wrapper' => 'form-wrapper',
        ),
    );
    if (!empty($form_state['values']['start'])) {
        $form['stop'] = array(
            '#type' => 'select',
            '#options' => array('3'=>'3', '4'=>'4'),
        );
    }
    $form['submit'] = array(
        '#type' => 'submit',
        '#value' => 'Submit',
    );
}

function form_refresh($form, $form_state) {
    return $form;
}

function stage_form_submit($form, &$form_state) {
    $form_state['ajax_commands'][] = ctools_modal_command_dismiss();
}


texts: How to display nodes on front page with Search API?

texts: I have installed the Search API, Facets API, along with Search Pages.  When the user goes to the front page, I want to display some default node results.  How can I do this with just the node results for a particular view mode, without the user setting filter criteria?


texts:
i am writing a module in drupal 8. I wish to add a javascript when loading that form.

function ajax_example_form_alter(&$form, \Drupal\Core\Form\FormStateInterface $form_state, $form_id) {
 $form['#attached']['library'][] = array('ajax_example', 'ajax_example.sync_script');
}

and i have defined the following at the module library yml file

sync_script:
  version: 1.x
  js:
    js/test.js: {}

but seems the js is not embedded. And i have put the js in a folder called js at the root directory of the module.

What is the way for drupal 8 to embed a javascript at the form?


texts:
a customer asked me about content dripping in drupal. he said that it works in wordpress, but he need that in drupal.

so first of all what is content dripping? He need its for his own customers, who pay for a abo of its site content. So the abo runs for e.g. 10 weeks and the user gets 10 nodes with content on them, e.g.  chapters of a book.

So what he needs now is that the content "dripps" to the user, so the user gets every week a new chapter.

My first intention was to use rules, trigger and node_access to build up a custom set of rules to give the user the permissions once a week.

Then i searched around a lot and found a php script what does excactly that. It gets a list of all members, looks for the date of the abo and checks against a cck field in the node, and if the date is higher than the week of the abo + abo registration date, the content gets accessible.

but it would be much easier and better if i had a module...

So is there any module that does excatly that? As far as i know is content dripping a well known method in online marketing, so maybe there is something?


texts: How to check in Twig file whether node has a field?

texts:
In my twig file i try to override the field. In the {% if %} clause I need to check whether a field has particular value, if yes then assign the value as a class.

{% for item in items %}
  {% if node.language.value == "English"  %}
    {% set example_classes = 'english' %}
   {% else %}
    {% set example_classes = node.language.value %}
  {% endif %}
  <div{{ attributes.addClass('field', field_name, example_classes) }}>
    {{ item.content }}
  </div>
{% endfor %}

the line {% if node.language.value == "English"  %} brings nothing, how can I get the value of the node's field_language in twig file?

In the field.html.twig a list of available variables is specified:

Available variables:
* - attributes: HTML attributes for the containing element.
* - label_hidden: Whether to show the field label or not.
* - title_attributes: HTML attributes for the title.
* - label: The label for the field.
* - multiple: TRUE if a field can contain multiple items.
* - items: List of all the field items. Each item contains:
*   - attributes: List of HTML attributes for each item.
*   - content: The field item's content.
* - entity_type: The entity type to which the field belongs.
* - field_name: The name of the field.
* - field_type: The type of the field.
* - label_display: The display settings for the label.


texts: How to display all the terms of a vocabulary with a list of the items associated to the term below in a view?

texts:
In a view in D8, I want to achive something like :

term 1
-item 1
-item2
term 2
-item 3
-item 4
term 3
- item 5
- item 6

Is it possible ? If yes, how ?


texts: Top article image not showing when I share content with Facebook or Google Plus

texts:
So I inspected the image element and everything looks fine compared to other sites code. But when I share an article from my blog nothing shows in the image section. Interesting enough if I share the same article on Linkedin the top article image appears like it should. Body images always show if any are present. it's just the top article image with the issue.

Here's an example: http://thepoliticus.com/content/how-well-do-you-know-state-union

Element:


texts: getting "Directory index forbidden by Options directive" error after upgrading from 7.34 to 7.36

texts:
After upgrading from 7.34 to 7.36, my homepage now reads: "403 - Forbidden Error
Common reasons for this error are:

Incorrect file/directory permissions: Below 644.
In order files to be read by the webserver, their permissions have to be equal or above 644. You can update file permissions with a FTP client or through cPanel's File Manager.

Restrictive Apache directives inside .htaccess file.
There are two Apache directives which can cause this error - 'Deny from' and 'Options -Indexes'."

I found "Directory index forbidden by Options directive" in error log and researched Drupal help blogs.

Then I changed permissions for settings.php as per one blog's recommendation, Website still will not load at all, even after permission given.

Don't understand Apache well enough to act on part 2 of original error screen advice about Restrictive Apache directives inside .htaccess file.


texts: How to assign blocks to particular regions on theme install?

texts:
Drupal 8 provides some blocks by default. Eg. Site Branding, Main Navigation, Powered by Drupal, Search etc.

I have created a theme that has Site branding & Main Navigation named regions in which corresponding blocks can be placed.

When I enable my theme, Site Branding & Main Navigation blocks are placed in Header & First Sidebar region of my theme by default respectively.

How can I place Site Branding & Main Navigation blocks to their respective regions by default on theme install?


texts:
I'm writing a block plugin that uses the form API to allow users to edit its settings, and then output them into a template.

I'm currently using

<?php

/**
 * @file
 * Contains \Drupal\my_plugins\Plugin\Block\InfoWithSideImage.
 */

namespace Drupal\my_plugins\Plugin\Block;

use Drupal\Core\Block\BlockBase;
use Drupal\Core\Form\FormStateInterface;

/**
 * @Block(
 * id = "infowithsideimage",
 * admin_label = @Translation("Info block beside an image")
 * )
 */

class InfoWithSideImage extends BlockBase {
    public function blockForm($form, FormStateInterface $form_state) {
        $form['image'] = array(
            '#type'          => 'file',
            '#title'         => $this->t('Image'),
            '#default_value' => $this->configuration['image_submit'],
        );
        $form['test'] = array(
            '#type' => 'textfield',
            '#title' => $this->t('Test text field'),
            '#default_value' => $this->configuration['test_submit'],
        );
        return $form;
    }
    public function blockSubmit($form, FormStateInterface $form_state) {
        $this->configuration['image_submit'] = $form_state->getValue('image');
        $this->configuration['test_submit'] = $form_state->getValue('test');
    }

    public function build() {
        return array(
            '#theme' => 'infowithsideimage',
            '#image' => $this->configuration['image_submit'],
            '#test' => $this->configuration['test_submit'],
        );
    }
}

The text field works fine, but whenever I try to submit with the file field I get the following error:

  A fatal error occurred: Serialization of Symfony\Component\HttpFoundation\File\UploadedFile is not allowed

Is there something I'm missing? Is it possible to use the form API to allow users to upload files?


texts: Where do you store arbitrary home page data?

texts: There's some welcome heading, text, video that goes on the front page. Currently this is stored in variables but it feels wrong to me because, well, it's a wall of text and variables is loaded on every page. Any module helping here?


texts: Multilingual menus: logic and architecture

texts:
A question dedicated for developers: What is the right Multi-lingual option for entities and menus in Drupal 8? In contrast to Drupal 7 that never asked me for a menu language, some entities and menus in Drupal 8 asks me for a default... But... I don't want a singular language for that menu... I want it to include 2 and even 3 languages... Thus what is the logical option? My question is basically comprised of two questions:

Is it Not specified? Or Not applicable?, and what is the difference between the two?
I also wonder why the ready-to-work menus that comes with the Drupal 8 installation, are not multilingual and are locked to the language in which the site was installed... Won't it be more flexible to set it to some kind of a multilingual option and that's it?...


texts: migrate drupal site , error occured, the site was down

texts:
I migrate my site from WinServer2003 to CentOS ,  with the following step:
1. migrate the database to the CentOS server with .sql files backup.
2.copy all the website root file to the new server.

when i  visited some node an error occured:

according to the message  there was a table or view was missing, but there was no such a table or view in the old system(win2003)

how can i fix the problem, any suggestions are appreciated, Thanks in advanced.

when i do some config (i delete the text format: filter HTML), the site  was completely down.
 when visit it just show an error:

i am really confused.


texts: How to transfer a block from one site to another?

texts:
I've built a block on my local site and now want to transfer it to a remote site.

I thought this was done via Features, so downloaded the feature files and placed them on my remote server. On the remote site I accessed Features, checked the box of the updated Feature I placed up there and hit save.

I've cleared the cache and theme registry but the new block does not appear on the remote site.

Would anyone know what I've done wrong here?


texts:
After upgrading or installing the module (trying to set up a forum for moderation), I lost the visibility of taxonomy for non-admin. Under Admin I can see the content of the entire website as a guest or authorized user materials on taxonomy unavailable.

  There is currently no content classified with this term.

Yes, there is a message updating the rights

  The content access permissions need to be rebuilt. Rebuild permissions.

Rebuilding the permissions fails with an error.

  An AJAX HTTP error occurred. HTTP Result Code: 500
  Debugging information follows.
  Path: /batch?render=overlay&id=5478&op=do
  StatusText: Service unavailable (with message)
  ResponseText: PDOException: SQLSTATE[42S02]: Base table or view not found: 1146 Table 'alenkiykin_drup.dr_file_metadata' doesn't exist: SELECT * FROM {file_metadata} WHERE fid IN (:fids_0); Array ( [:fids_0] => 38 ) in file_entity_file_load() (line 183 of...`

Perhaps the problem is in the database.


texts: htaccess settings to allow access to special non-drupal page

texts:
I have a properly working Drupal 6 site, at the webroot of my server, which can be accessed by www.mysite.com or by mysite.com. I have some special html files (not part of Drupal) that can be currently accessed by going to mysite.com/special and that works fine.

I would prefer that people just go to special.mysite.com to get to the html files in that directory (instead of mysite.com/special).   I just had the DNS set up so that special.mysite.com now points to the webroot, and Drupal currently handles it the same as www.mysite.com.

However, I would like it if people coming to special.mysite.com arrive at the index file within the "special" folder on mysite.com. I bet I can do something to the .htaccess file that Drupal uses in the webroot directory - but I don't know what? Any advice? Thanks a ton.


texts: I get 404 when uploading private *image* files in D7

texts:
I have this Drupal 7.15 site (it needs an upgrade, I know).

I have some public and private files in there (all according to my settings). I have a public file field and a private file field.

So, using my private field, I can upload some files that are set to private (I've set the allowed extensions as: .zip, .pdf, .jpg, .png, .gif, and some more). I'm the only user allowed to use the private field.

When I upload an image file (png, jpg or gif), it does get uploaded ok, but when trying to click on the link I get a "404 error". When there's any other file type uploaded, everything works just fine.

The private files field is inside a content type that is set as a "group content type".

All files get uploaded ok and they do appear at the list of uploaded files in the normal way.

Some configuration information

My Apache file handler is mode_php (aka DSO).
Permissions and file owner of all files (images or not) are the very same: rw-rw-r-- (664)
Group and owner are the same too (images or not): nobody and nobody
All files are being uploaded to the same folder: ../files/private/filename.ext
All files get the same symlink: ../system/files/filename.ext

But only the pdf file is accessible to users (with perms to view the node). Even as an admin I get the 404 error when trying to access the image files.

What's wrong?


texts:
I have a content type that has a file field. I would like the body field to be able to link to the file. E.g. "Our research (PDF download) shows..." with the link becoming the download path for the file.

I can see the challenge: the path may not even exist at the time of creating the content. Is this something the token module can help with?


texts: Is it possible to add/remove form elements with clientside js? I am using ajax, but it is a bit too slow for the kind of dynamic elements I need.


texts:
As you know comments are displayed like this:

So it shows the subject, and then says: Comment and shows the comment body.

So I have a new field in comment table called "paragraph_id", so before the comment subject, I want to say:
          Paragraph Number:
  and then display the value in paragraph_id value.

How can I do it? Which hook should I use?


texts: Mapping delimited text field to taxonomy field in Migrate

texts:
I have a migration from an external (non-Drupal) DB which is currently working correctly. I am trying to add a field from the external DB which contains a delimited list of terms.

I have set up the field mapping as follows:

$this->addFieldMapping('field_test_structure_families', 'proteinfamilyname')
     ->separator('@');

$this->addFieldMapping('field_test_structure_families:create_term')
     ->defaultValue(TRUE);

$this->addFieldMapping('field_test_structure_families:ignore_case')
     ->defaultValue(TRUE);

I want to dynamically add these terms to the taxonomy specified on the field_test_structure_families field - from the documentation that should be what is happening with this config. There is no pre-existing term vocabulary in the external DB.

When I run the migration and try to update existing nodes, nothing is added to the field or the specified vocabulary. The target field is set as an autocomplete field. I have tried with checkbox/radio setting with the same outcome.

Where am I going wrong? Is it that this won't work with pre-existing nodes? Any help welcome.


texts: What would be the most efficient way to select node for a content type?

texts:
Right now i am using this query :

$query_info = db_query("SELECT nid FROM {node} WHERE type=:type  AND language = :language AND status=1",
                array (':language'=> $language->language, ":type" => 'info_pages' , ))->fetchCol();
$info_pages = node_load_multiple($query_info);

As this site is going to have lots and lots of content I am wondering if this is the right way ? If not what would be a better approach ?


texts: How do I get the submitted value for a field?

texts:
I have a custom submit handler:

function submituserform(array $form, FormStateInterface $form_state) {
  $email = $form_state->getValue('field_email');
  drupal_set_message('Thank you for for submitting your application. You will receive a confirmation at ' . $email . ');

  $redirect_path = "/confirmation";
  $url = url::fromUserInput($redirect_path);
  $form_state->setRedirectUrl($url);

}

I get Array as value for the email. How do I get the email from field_email?


texts: Displaying all the entity reference entities in a view

texts:
I have a "press release" node type which uses entityreference to link to any number of file_entity images, another field for file_entity videos and another to file_entity audio files.

There is a need for a block to display the first six images from the most recent press release, with some text from the press release.

So I built a view that finds the most recent press release and then displays the first six image entities. Or it should have but it doesn't, it always reports zero images (or zero videos, or zero audio files) regardless of how many there are.

So I ripped into Views to find the problem and discovered that entityreference does not provide a field handler, as a result Views assumes it's referring to a node and not an image and it all goes pear-shaped.

All entityreference does is provide a relationship handler, which is fine as far as it goes but you can only display one entry from the list of references - the first one.

Am I really going to go completely non-intuitive and have the images as the main table, and then sort by and group by parent press release node?

Any better ideas? (Short of writing a proper Views field handler?)


texts: Content Type with People (list of people) in Select List to Choose From

texts:
diving deep into Drupal 7 as a noob and wondering how can I create a field (select list) in a new content type that pulls in all the users in the system? I'd like to be able to associate certain content with a person, not necessarily as the author, but as the "person in charge of this area" for example. I'd like to show the persons name and some other info from the "people" area of the Drupal 7 core.

I am thinking I should use the people area rather than create a new content type for people. I added new fields to the "new user" form.

Any thoughts or ideas?

EDIT:::

Did find https://drupal.org/project/references module that seems to work great. However, I still would like to know if using People area is best for storing all users / people associated with my Drupal site. Thanks :)


texts:
Since I updated to 8.6.10, I can no longer edit a new view. I can create a view but  when I go to the main interface after clicking Save & Edit, nothings works. No matter what I click on, aside from the brief display of turning wheel, nothing happens.

I have checked the log and no error messages and strangely, existing views are working well.

Update:
Error message from DevTool console shown below


texts: Redirect logged in (authenticated) users to a different frontpage using rules or php code

texts:
I need to always redirect authenticated users to a different page (to serve as their own frontpage) whenever they try to access the default (anonymous) frontpage. I want to achieve this using rules or through some custom php code in my template.php or settings.php file, NOT by enabling a new module. Thanks.

Added: i created the frontpage using Page Manager (packaged with ctools)


texts:
I want to use a specific tpl.php file for all Panels Custom pages.

I get some formatting issues if I try to use "Panels Everywhere" module, so would like an alternative.


texts:
When I tested modules in Feb I am sure I got this working but nothing works now; I want the user to be able to upload a KML file when creating a node, and for that to display on a map. I am not even trying to combine multiple, just display each node's KML on an OpenLayers map.

I have tried the following module combinations:

Geofile

This is giving me an error which may just be an issue with the latest OpenLayers version.
Issue on Drupal.org: EPSG fix is needed

OpenLayers KML Layer

The instructions on the module make it sound simple but I have not managed to get this to work.

Geocoder

Module home page suggests that you can set a field to geocode from an uploaded KML file, but I have not managed to get this to work and I do not see any errors.

Does anyone have this working?

Note: I know one can define a static KML layer in admin/structure/openlayers/layers, that is not helpful as I need a person to be able to upload a KML file on a node.


texts: Append image style to an inline image in CKEditor

texts:
With views, for example, I'm able to set the image size which is to be loaded (using image styles). Is it in any way possible to do such thing in CKEditor?
At the moment, Drupal is loading the original image and scales it down in the browser.
I need to set an image style so all the inline images are resized to a width of x pixels.


texts:
I just have followed two tutorials on Youtube, https://www.youtube.com/watch?v=79zYcIoheCc&t=43s and https://www.youtube.com/watch?v=SAP9clnOf9E&t=8s.

The result was a "You are not authorized to access this page." error.

In the routing file, I have made the correct indentation for both modules.

my_module.routing:
  path: '/admin/structure/my_module'
  defaults:
    _title: 'My module'
    _content: '\Drupal\my_module\MyModuleController::test'
  requirements:
    _permisions: 'access administracion pages'

hello_world:
    path: '/hello/world'
    defaults:
        _controller: 'Drupal\hello_world\Controller\HelloWorldController::hello'
    requirements:
        _permisions: 'access content'


texts:
I need to add multiple values to the repeating date field.

I have to make the schedule for a university classes. So I might have multiple groups with different schedule (different hours for each group) for the same class.

Now it's dificult to assign the schedule for each group on the same node (I don't think it is even posible), but I think at least I could have multiple values on each repeating date, e.g. each thursday at 12:00 and 14:00, and each friday 10:00 and 16:00.

I'm using the latest Drupal 6 and CCK.
I can't use Drupal 7 at the moment for this project, but minor version upgrades can be possible.


texts:
I know there are a couple modules other there that handle login redirects like Login Destination, LoginToboggan, Login Redirect and Rules.  However, they all seem to only allow strict URLs.  I would like users to be redirected to the same page they logged in on.  The default behaviour of Drupal appears to redirect users to the previous page on login.

Since I am using a login modal, redirecting people to the previous page doesn't work well.

How can I redirect users to their current page when using a login modal that handles the login through AJAX?  I would appreciate a solution that could be placed in template.php maybe using hook_user_login()


texts:
Does this function views_get_current_view inside views header or footer (to count rows number for example) means running the same view twice?
 Or is it somewhat simplified version of running full view? Thank you.


texts: Can I change the post's created date format?

texts: Can I change the date format without touch the code level? I only have admin access. Tried to search for solution but all of them are code level.


texts:
I have a Field Collection called "Tab Content" which contains fields such as title, body, and a nested Field Collection called "Content Sidebar". The idea is that you can enter information that populates into a tabbed interface.

In each of these tabs, there is a sidebar which can contain any number of what I'm calling "callout boxes". The "callout box" fields live within the "Content Sidebar" field collection so the user has the ability to add multiple "callout boxes" per tab. I have everything printing out using the code from here: http://drupal.org/node/1398966 but the problem I'm having is that each tab is printing out every "callout box" when it should only be printing out the ones assigned to that tab.

Screenshot of what happens below. The Second tab is highlighted and displaying all the callout boxes when it should only be showing the "Second Tab Callout Box" while the first tab should contain the other two.

Here is my current code:

  <?php foreach ($node->field_tab_content['und'] as $key => $value) {
    $img_val = null;
    $field_collection = entity_load('field_collection_item', array($value['value']));
    $idx = $value['value'];
    $sectiontitle = $field_collection[$idx]->field_section_title['und'][0]['value'];
    $sectioncontent = $field_collection[$idx]->field_section_content['und'][0]['value'];
    $filteredtitle = preg_replace("/[^a-zA-Z0-9\s]/", "", $sectiontitle);
    if(!empty($field_collection[$idx]->field_sidebar_image['und'])) {
      $img_val = $field_collection[$idx]->field_sidebar_image['und'][0]['filename'];
    }
    $img_url = $GLOBALS['base_path'] . 'sites/default/files/general/' . $img_val;
  ?>
  <div id="<?php echo strtolower(str_replace(' ', '-', $filteredtitle)); ?>">

      <?php echo $sectioncontent; ?>

      <?php if ($img_val): ?>
        <img src="<?php echo $img_url; ?>" alt="sidebar image" />
      <?php endif; ?>

      <?php //Here is the nested field collection
        $top_level = null;
        $second_level = null;
        foreach ($node->field_tab_content['und'] as $top_level_collection) {
          $top_level = load_collection($top_level_collection['value']);
          if(!empty($top_level->field_content_sidebar['und'] )) {
            foreach ($top_level->field_content_sidebar['und'] as $second_level_collection) {
              $second_level = load_collection($second_level_collection['value']);
              foreach ($second_level->field_callout_box_title['und'] as $callout_title) {
                print "
";
                print '
' . $callout_title['safe_value'] . '
';
              }
              foreach ($second_level->field_callout_box_content['und'] as $callout_content) {
                print "
" . $callout_content['value']. "
";
                print "
";
              }
            }
          }
        }
      ?>

<?php }; ?>


texts:
There are many posts available for migrating the content to D8. But i am not able to understand. I am stopped at some points.

What I have cleared yet?

  Till now there is no UI available node import.
  Feed module not supporting node import.

What I wants to know?

Is it mandatory to create a custom module to achieve this?
Drush is required?


texts:
I want to customize the maintenance page in Drupal 8.

How do I theme it?


texts: What module do I turn off to hide or remove the voting widget in Drupal Commons?

texts: Our client wants this voting widget turned off? At worst, I could hide with CSS but I'd like to turn this off. What module produces this? Should I remove/hide a field from the content type?


texts: How can i remove title requirement for content type

texts:
For example i have content type article i need to remove requirement for title, right now its a Node module element and i can not edit it. I found module title but when i installed id and tried to change title, my site crashed.

Is there any solution to achieve this?

Should i remove title on content type edit page and replace it with editable field?

UPDATE:

Some of you maybe do not understand me right). So i have content type Answer and this c.type has two fields title and body. When someone want to answer atm he needs to fill title field every time he wants to answer, but i need to give user a choice to just fill only body field OR body and title if user want to fill the title. The title field should be displayed on node edit every time!

So only way i see viable is to create new field and  hide title with automatic-node-title module...


texts:
I am trying to write a custom module in Drupal 8 to populate a taxonomy field (release_decade) based on information in another field (release_date) for a custom content type in order to create an exposed dropdown filter in a view.

I am using hook_form_FORM_ID_alter & have tried attaching JS as suggested in autofilling-fields-based-on-another-field but the script does not seem to run & most of the other examples seem to cover Drupal 7.

Does anyone have any Drupal 8 specific suggestions for either:
a) Autofilling a taxonomy field based on other content fields?
b) Automatically assigning a taxonomy item to a hidden property when an entity is created?

Or am I going about this completely the wrong way?


texts: Why is the chart button missing when trying to create a chart using Easychart?

texts:
I have chart content type and chart content.

But when I try to add content I do not see the chart button, as shown in this image also:


texts:
i have a webform with a lot of fields(i am making some kind of calculator for my needs) and after submit i need to show custom output under my webform.

In hook_form_alter i have added custom submit handler
$form['#submit'][] = 'common_webform_client_form_1562_submit_handler';

and after submit i need to show my results on same page.

function common_webform_client_form_1562_submit_handler($form, &$form_state) {
   //some logic here

   //redirect to node with my webform
   $form_state['redirect'] = 'node/1544';
}

As i can see i cannot modify or add anything to a $form i thought i can add #suffix to webform and attach my results but i can't, should i do it with Drupal.settings and grab it with javascript? or is there another option?


texts:
Let me just preface this by saying I know nothing of Drupal. I am a wordpress developer but my company just inherited 2 drupal sites from a company we recently purchased. I am using Drupal 6.25.
I have 2 classes of products that I need to change shipping for. It's free for US east coast and $199 for US west coast.  There was a generic free shipping already set up and working but I need to change for the shipping increases. I tried using the flat rate and conditions but I kept getting "Invalid option selected. Recalculate shipping quotes to continue". I set up west coast fine. I did 2 groupings -  a main AND group with 2 OR groups in that - 'or' for the shipping states and 'or' for the 2 product classes. I disabled the previous free shipping and the west coast works fine. I set up a separate shipping for east coast just like the west coast but opposite states. It works fine if I disable the West Coast. So, obviously I am doing something that is conflicting when both are enabled.

Any and all advice is greatly appreciated!


texts: Create a custom Link to a File-Field in Twig

texts:
I'm trying to customize a download-link for a file-field in my entity.
In a similar setup, i was able to customize a link-field in the following way:

 Link

So, for the file-field, i tried something similar:

 Download

However, there is no such thing as a uri field available. I have a hard time figuring out which fields actually are available for me to use in the template. I found kint to be way too noisy, i had to restrict memory consumption and still have no clue which fields are usable.

Alternatively, i tried to create a custom template for the specific file field, called field--field-publication-file.html.twig. The debug info tells me that it is used for rendering.
I had a look at the field that my theme (bootstrap) normally uses and tried to mimick its behavior. Specifically, i wanted to use the field link, which is also used in the bootstrap version. However, this field is always empty when using my version.

What more could i try?


texts: Hide contextual filter parameter from view url

texts:
I'm using Views to create a view which shows list of contents. The requirements of the view is something like this:

The page display url must be /mycontents
The contents must be filtered by current user(The content's author must be current user).

And what I did:

Set Page settings > Path to /mycontents
In Advanced > Contextual Filters , add Authored by
In the contextual filter's When the default value is not in the url section, checked Provide default value and selected User ID from logged in user.

The problem is that after saving the view, the actual url of the view becomes /mycontens/{uid}. Is there any way to remove the {uid} from the path?


texts:
I am using the phpCAS  library and would like sessions to be handled by that library.

I am instantiating the client this way:

function my_module_init(){
    ...
    phpCAS::client(CAS_VERSION_2_0,'casdomain' , 8443, '/cas',true);
    ...
}

I have it in hook_init() since I want to check for user authentication on each page load.

But I am getting this error.

  phpCAS error: phpCAS::client(): Another session was started before
  phpcas. Either disable the session handling for phpcas in the client()
  call or modify your application to leave session handling to phpcas

How can I get rid of this error and have phpCAS handle the session?

Thanks.


texts:
I installed a custom theme called StartupGrowth. At the moment, I am trying to edit the main navigation. When I go to Structure->Menus->Main Navigation and disable the unneeded entries, they do not disappear from the navigation. However, if I add a new entry to the menu, it does appear. What's more, when I attempt to delete the entry added by me, it persists in the navigation just like the other ones.

What am I missing? Is there another place for editing this menu? Or does this sound like a bug in the theme itself?


texts: List child terms according to parent term page

texts:
I created a view listing all parent terms  and child terms in my site. Following those suggestions:
Tiered HTML lists using Views and Taxonomy?

Now, I need to make the list of child terms change automatically according to the parent term page. For example:
In the parent term page: Fruits,
This view will show a only a list of those terms:

Bananas
     Apple
     ….

In the parent term  page: Colors,
This view will show only a list of Colors child terms:

Red
     Green
     Yellow

Any Idea how to do this?