texts:
I enabled the contact form menu link, and then attempted to change the parent link to the Main Menu. However, instead of making the parent link < Main Menu >, I accidentally made the parent link Main Menu under < Management >. Now I am now unable to set the parent link for the contact form.

However, I can see the contact form's position in the parent link drop down menu when that menu is accessed using +Add Link in Structure > Menus > Main Menu. Here's what I see (with some lines omitted).

--Administration

----Structure

------Menus

--------Main Menu

----------Contact (disabled)

When I look at all of my options under Structure > Menus in the Adminstration tools, nowhere am I given an option to enable and change the contact form menu link.

I've tried disabling and reenabling the Contact module, logging out and logging back in, and flushing all caches. None of that helped. Thanks for any assistance.


texts: How do I share configuration between custom admin form and node type edit form?

texts:
I have a module that requires some settings per content type. The module is to also provide one admin page where all the settings can be applied across content types at once.

Essentially I'm trying to share configuration information between a custom Admin Settings form and the node type edit form. I had this all working with Drupal 8 Beta 10 or something like that, but I'm trying to get it working with the latest stable release (8.0.4).

I originally used the method described here for my custom Admin form using the following code:

$config = $this->config('mymodule.settings');
'#default_value' => $config->get('my_setting'),

Similarly, for the node edit form alter function, I used:

$config =  \Drupal::config('mymodule.settings');
'#default_value' => $config->get('my_setting'),

But the above stopped working for the node type settings form at some point, so I started looking at using Third Party Settings:

$node_type = $form_state->getFormObject()->getEntity();
'#default_value' => $node_type->getThirdPartySetting('mymodule', 'setting', 'default_value'),

This works great for the node type edit form, but I don't know of a way to pull the third-party settings into my custom Admin form partially because getEntity() method isn't available.

So my question is, what is the best practice for sharing configuration settings between a custom admin form and the content type edit form?


texts:
Is there a way to quickly create taxonomy categories by importing a csv file?

If so would it preserve any hierarchical relationships?

I've explored the taxonomy_csv project just not totally sure if it does what i wanted.


texts:
I am currently developing a real estate website, and the client wants to push a notification to his Facebook page when he edits or adds a real estate.

How can I achieve this, with a module or hard-coded?


texts: Does Multiupload Filefield Widget for Drupal provides a Form API element?

texts:
I have a form in on of my Drupal page that uses Multiupload Filefield Widget to upload multiple images at once.

I want to alter the functionality of this Multiupload Filefield Widget from my custom module using hook_form_alter.

At first I thought It will be a managed_file widget. But it is not.

Is there a way to do it?


texts: How to use the Features module in a 3 dev environnement?

texts:
Working on a project,  making heavy use of Features, there is sometimes 3 devs for this application.

We have tried a few approaches, but when we merge our git branches it seems we often 'over-write' each other's feature changes.  Conflicts abound, breaking the feature module making it painful to use, it seems.

Features is really an awesome timesaver for configuration for one on projects, and I am quite sure there is a way to tackle this.

Is there a workflow or procedure that reduces risks of conflicts and overwrites?

Any clues on features is welcome.


texts: How to add twig code in View 'global custom text' field?

texts:
I want to add if condition in my "global custom text" field saying if node is published, print some link. I tried below steps , but it is not working:
1.I have added "Content: Publishing status" field and hidden it from display
2.In 'global custom text' field added below code:
Replacement pattern for published status is {{ status }} and is returning 0 or 1.
Code I added is:

  {% if  status  ==0 %}

 APPLY

    {% endif %}

Drupal Version:8.2.0

Can anybody help me to make this working?
Thank you In Advance


texts: Server Error 500 - Edit Tab of Managing Custom Fields of Custom Content Types

texts:
Alright, I've got a very irritating error with my site. Whenever I try and Edit a file or image field I get what appears to be a half-loaded page (see image below)

I have check an error log and have received this error at about the same time I was accessing this type of page...

 [15-Jun-2016 22:03:35 America/Denver] PHP Fatal error:  Allowed memory
    size of 134217728 bytes exhausted (tried to allocate 9332483 bytes) in
    /home/cocempro/public_html/portal/includes/database/database.inc on line 2171

And while double checking that maybe it wasn't just my browser, I also have received this error from Internet Edge (I don't normally use it, just thought I'd try):

SERVER ERROR - The server encountered an unexpected condition that prevented it from fulfilling the request. GET - http://example.org/admin/structure/types/manage/site-photograph-gallery/fields/field_-images

So is this with my server or my Drupal installation? I will clarify that I have found that no other field type (either text, date, summary, whatever) is affected by this, only file and image field types.

Any ideas?

------EDIT----
Oh and none of the other tabs (such as Widget settings, or delete) are affected by this error...


texts: How to display only New comments from all nodes of a content type?

texts:
In short:

Is there any way to display list of New/Unread comments from all nodes of a content type for the logged in user?

In Detail:

I've created a "content" view of "basic" type to display new/unread comments for the logged in user.

But I found the way only to display the count for "new comments".

View Details:

Relationship: Content:Author

Filter Criteria: (author) User: Current (Yes) > (It display the nodes created by currently logged in users)

Fields:

Content: Title (Title)

Content: New comments (New Comments)

Output:

Is there any way to display only list of unread/new comments for all nodes of a content type for the logged in user?


texts: Get all nodes of a specific content type and print the data of each node inside page.html.twig

texts:
I have a content type (Flower) with two fields: Name and Color.

In my-theme/templates/page.html.twig, I want to print the name and the color of each flower.

    {% for flower in flowers %}

{{ [Flower Name Here] }}

{{ [Flower Color Here] }}

    {% endfor %}

How can I get all nodes of a given content type and print the values of each node inside page.html.twig?


texts: Get the titles of the nodes whose node IDs are contained in a field

texts:
$attr = explode(",", $node->field_xlnum[0]['value']);

$node->field_xlnum[0]['value'] contains 20,4,56,987,68,96, where each value is a node ID.
I want to get all the titles, and output them in an HTML list. How do I do it?

I tried the following code, but it doesn't work.

$attr = explode(",", $node->field_xlnum[0]['value']);
$result = db_query("SELECT nid, title FROM {node} WHERE nid IN ($attr) AND type = %s order by created DESC", test);
while(($items = db_fetch_object($result)) {
  $output = theme_item_list($items, array('class'=>'tabs primary'));
}

echo $output;


texts:
I am using the Drupal 8 REST API to post content to a custom content type. I have a use case in which I need to post multiple values to a single multi-value field. If someone can show me how to do this it would negate my question.
As an alternative, I believe I could use the Paragraphs module to create a fieldset within my content type. I am writing to ask if someone can give me an example of how to post (or patch) my multiple values to the paragraph fieldset.
I should add that I do not know in advance how many values I will have in my multi-value dataset; it will vary by node. Its for that reason that I think either a multi-value field or a paragraphs fieldset might suit better than just creating additional fields in the content type.


texts: display data (taxonomy terms) after uploading it directly to the database

texts:
I have created a taxonomy vocabulary and then uploaded via mysql all the needed tables for the different fields.

I have created a view where I can see all the terms of the vocabulary, but if I go to /admin/structure/taxonomy/myvocabulary I can only see the terms that I have edited and saved, where, which table I have to modify for the terms to be displayed at the vocabulary page?


texts: Manage Display formatting settings won't work

texts:
I've got a problem with formatting decimal fields in Drupal using the Manage Display settings. I've already specified a thousands separator for this particular decimal field:

And clicked Update and Save: (see that it displays a sample value already formatted)

However, when I go to the actual field, it doesn't have any formatting:

Already tried formatting this field using a combination of a jQuery plugin and #attributes in this field's array, but Drupal won't save the value since it only accepts the dot and numbers as valid decimal value.

Is there anything I'm missing here? I should also say that I'm using a custom theme. I'm also willing to give info about my code as long as it doesn't touch sensitive business logic.


texts:
The readme.txt of the Facebook Connect module is seriously out-dated! It really needs a review concerning the FB updates.

Now, the real problem:
I have installed the module, inserted my appID and all that, but when in /admin/config/people/fbconnect I click on 'appearance' I get this fatal error:

Fatal error: Call to a member function getUser() on a non-object in /customers/denotenbalkers.be/denotenbalkers.be/httpd.www/sites/all/modules/fbconnect/fbconnect.module on line 421

When I click on 'app settings' it shows me the notice: "Ensure that you entered valid api keys." but those keys ARE valid. Maybe I'm missing something from the readme? Ex.:

5. Enter the Connect URL on Connect settings tab (e.g. copy value from admin/settings/fbconnect field “Connect url”).
There is no such thing as a connect settings tab!

6. Add your server to the Server Whitelist on Advanced settings tab on Facebook or disable Session Secret Whitelist Exception.
What am I supposed to add here? Because only the url doesn't work. I suppose an IP-address but I wouldn't know which one.

I've done all the rest, so I'm guessing that that's the problem.

EDIT / SOLUTION:
The problem was that I followed the readme that was on Facebook Connect's project page. The information in there is OUT-DATED and insufficient. The readme that comes with the module itself is the one you should read!


texts: How to properly compare values of two identical entities?

texts:
I have a custom entity that is not revisionable and I need to store any differences made by the user - and only differences, so if nothing has changed there should be no entry.

I am doing this in preSave method because the original entity has the same format as current entity(ie. some fields do some value processing and therefore the original entity does not match the current entity exactly in postSave method).

The issue I am facing is that I cannot properly compare values($entity->toArray()) because the data is not consistent. For example in the original entity a field's value can be 123.8 but in the current entity it can be 123.8999999... If I type cast it to string I end up with something like '123.8' vs '123.80' so the values won't match. Or 1 can be '1' and so on. Also with arrays I think keys get misordered sometimes(either that or the same issue but in the whole array).

I have tried to use the DiffArray::diffAssocRecursive() and Differ::diff() but neither is working reliably.

One thing that comes to mind is doing something like
Differ::diff($entity->view('somemodewithallfield'), $entity->original->view('somemodewithallfield')) but that won't cover fields that are hidden or invisible in UI and also diff would be "ugly" and too big.

So I am wonder what would be the correct solution in this case? I would like to avoid going through each value and doing some insane comparisons and data transformations(string/int/float).

I remember that there was a story on d.org to not save any field data if the data hasn't changed but I haven't looked into that yet and I'm not sure at what state that is at the moment.


texts: Colors to my header and footer not applying by using color scheme options in my theme

texts:
I am trying to incorporate color scheme which is available in  bartik, into my theme. I am able to generate the files which will be located at

  sites/default/files/color/theme-4855b5/colors.css

after making options in color scheme of my theme.

But in the head tag of styles files, it still points to my theme directory colors.css instead of above mentioned directory, Which results in no change of colors for my theme.

My theme is actually a sub theme. What am i doing wrong ??

I have included color folder and inside that have color.inc files.
Also included color.css folder inside css folder.
hook_process_page(&$variables)  and     hook_process_html(&$variables)  these functions included in template.php
included css file in info file too.  stylesheets[all][] = 'css/colors.css'

What am I missing in not getting that css being replaced by dynamically generate one? Thanks in advance.


texts: Why are some images not displaying after migration to localhost?

texts:
I just moved a site from a production environment to an ubuntu based localhost set up and some of the images aren't displaying and are popping up in the console as 404 errors.

The files are present on the localhost set up, and they have the same permissions as the images that do show up. I think this means that the files are corrupted. So,

How do I test/fix this?
How can I prevent this from happening in the future?


texts:
I am writing a custom module that will output an image on the page. I believe that I should have this image in my module folder and not rely on that image being in the site files. I'm not sure how to reference that image to produce the img tag.
mymodule
-/mymodule.info
-/mymodule.module
-/files
-/files/myimage.png

I want to be able to render the image so that the source is displayed with an img tag:


texts:
I installed drush 9 and now I'm getting the following error whenever I run a drush command:

/usr/bin/sh: /cygdrive/c/mysite/vendor/drush/drush/drush.launcher: No such file or directory

Details:

I have installed drush 9 on Windows 7 using composer. This was an update to my previous drush 8.
The drush files are installed in my local site's vendor directory.
The drush.launcher file is in the directory indicated in the above error message.
To run a drush command, I go to my site's root directory using MINGW64 and run the command using vendor/bin/drush. for example:

vendor/bin/drush drusn --version

I have C:\mysite\vendor\bin in my path environment variable.
I don't want to use drush.launcher at this time but not sure why it gets invoked and yet not found.

Thank you in advance for your help.


texts: Programatically Submitted Form With 'file' Field Throws Notice

texts:
This seems to actually be a problem in Drupal itself. In /modules/file/file.field.inc the function file_field_widget_form has a line like this near the bottom (just before the return statement):

$elements['#file_upload_description'] = theme('file_upload_help', array('description' => '', 'upload_validators' => $elements[0]['#upload_validators']));

The issue is a small if condition a few lines back which looks like this:

if (($field['cardinality'] == FIELD_CARDINALITY_UNLIMITED || $delta < $field['cardinality']) && empty($form_state['programmed'])) {
    $elements[$delta] = $element;
    ...
    some more stuff
}

Since I am submitting my form programatically with drupal_form_submit, it adds in $form_state['programmed'], thus the if condition fails, $elements[0] does not exist and I get the error

Notice: Undefined offset: 0 in file_field_widget_form()

My form is submitted by a custom routine (in a custom module) that looks a bit like this:

foreach ($field_data as $k => $detail) {
    $field_key = _get_field_keys('field_' . $k);
    $field_key = $field_key[0];

    $node -> {'field_' . $k}[$node -> language][0][$field_key] = $detail;
    $form_state['values']['field_' . $k] = $detail;
}

drupal_form_submit("{$node->type}_node_form", $form_state, $node);

The form state before I call drupal_form_submit looks like this:

Array
(
    [values] => Array
        (
            [title] => some title
            [name] => admin
            [op] => Save
            [field_person] => 88
            [field_lead_type] => 1
            [field_lead_details] => some stuff
    )

)

What is the fix? I'd rather not mess with core modules. Is there something I can do to my own code to resolve the problem?


texts: Problem with images on a slideshow of product displays (Views Slide, Flexslider)

texts: Kind of a strange problem with trying to make a slide show of my product displays. I am creating a slideshow from content of type product display (ordered by newest first). The issue I have is that adding the fields Content: Image, Content: Product Image, or Field: Product Image doesn't load an image. I get asked about image styling, so clearly drupal knows that it's an image. I wouldn't think that I would need to add a relationship, because I have almost an identical view elsewhere that readily brings in the images. So can someone set me straight here?


texts: How do I create sub-pages for a custom content type?

texts:
In Drupal 8, I'd like to create a set of page that relate to a parent content type as so:

Movie (site.com/movie-name)

Reviews (site.com/movie-name/reviews)
Actors (site.com/movie-name/actors)
...

I'd like each child to be it's own page, but retain some information from the parent (e.g. Movie Title, Movie Image, etc.).  Also, I'd like to display a menu navigation that is smart enough to adapt to each parent (perhaps a simple menu with relative paths would suffice?).

I imagine that I'll want to use views to accomplish this.  Any pointers?


texts:
I am using Drupal 7 and the latest Migrate module. I am trying to create a class to migrate products from an OpenCart DB into my new D7 site. I figured out all the SQL I need and got most of that programmed in. But I am having a little trouble understanding how I am going to do the categories.

My migration target is Ubercart.

What I am trying to understand sits in the migrate_example module which is a submodule of Migrate. Specifically I am looking at the wine.inc file at the WineWineMigration class. I am trying to understand the term migration.

I have two lists that will become taxonomy terms in the Ubercart products. First is the categories. I have setup the categories manually, so when I bring the list of those over (using the GROUP_CONCAT SQL func) I will have a bunch of IDs that I will map using an array that will hold all the ID conversions. That is fine, but when I look at their BestWith info that they are migrating it shows that it is using the WineBestWith class above to import the term.

I am confused by this because it looks like some kind of secondary migration of terms. Is that what is happening? Further, is this where I would put my mapping array, in this term migration class?

The next thing I need to do is deal with tags. In OpenCart we have a bunch of free form tags. And when I manually create a product in Ubercart I have an autocomplete field for tags. In that field I can just put in a comma separated list of terms and it creates multiple terms. Can I do the same thing in the Migrate module? Can I just map the field to the list of comma separated terms? Will that add the tags in there for each product?


texts: How to programmatically set Webform field value with custom submit?

texts:
I try to update an hidden field value with my custom submit, but it doesn't work, my new value are not saved.

With :  $form_state->setValue('token_uid', $token_uid);

  function MODULE_form_alter(&$form, FormStateInterface $form_state, $form_id) {

    if ($form_id == 'webform_submission_creation_compte_add_form' || $form_id == 'webform_submission_creation_compte_test_form') {

      foreach (array_keys($form['actions']) as $action) {
        //attention en multi step : wizard_next
        if ($action != 'wizard_next' && $action != 'preview' && isset($form['actions'][$action]['#type']) && $form['actions'][$action]['#type'] === 'submit') {
          $form['actions'][$action]['#submit'][] = '_MODULE_creation_compte_submit';
        }
      }
      if (isset($form['#validate'])) {
        $form['#validate'][]  =  '_MODULE_creation_compte_validate';
      }
    }
  }

My custom submit function :

function _MODULE_creation_compte_submit(array &$form, FormStateInterface $form_state) {
    global $base_url;
    $data               = array();
    $user_id_created    = null;

    //Info account
    $account_name       = $form_state->getValue('nom');
    $account_username   = $form_state->getValue('username');
    $account_first_name = $form_state->getValue('prenom');
    $account_mail       = $form_state->getValue('email');
    $account_password   = $form_state->getValue('mot_de_passe');
    $account_phone      = $form_state->getValue('telephone');

    if (!empty($account_username) && !empty($account_password) && !empty($account_mail)) {

        $account_username   = strtolower(str_replace(' ', '', $account_username)).'_'.rand(0,1000);

        $user_created       = User::create([
          'name'                  => $account_username,
          'pass'                  => $account_password,
          'mail'                  => $account_mail,
          'field_user_nom'        => $account_name,
          'field_user_prenom'     => $account_first_name,
          'field_user_telephone'  => $account_phone['phone'],
          'status'                => 0,
          'init'                  => $account_mail,
          'created'               => time(),
          'changed'               => time(),
          'login'                 => 0,
          'access'                => 0,
        ]);
        $user_created->save();
        $user_id_created = $user_created->id();
        $token_uid       =  $base_url . '/user/' . $user_id_created;

       //==> Value is not saved after submit
        $form_state->setValue('token_uid', $token_uid);

    }
}


texts: Can we return 2 table themed arrays in function

texts: I have 2 arrays, but the 2 have different key values you can see in foreach for one it is src, where as for another it is source. I would like to show the both both tables on one hook. But this seems not working.


texts: Need to add meta tags in custom page created by custom module

texts:
I have installed "Tagadelic" module.Then I created one custom module to display tag clouds in a page.
Now I need to add/modify meta description for this page only.
So what is the process for it?


texts: How can you display the current user's name in the header region?

texts:
I created a new user. When they logs in, they should to see their user name in the header region.

I can create a block for header but I am not sure how to create a block that displays the username of the logged in user.


texts: Display taxonomy terms in node_content-type.tpl and node_content-type--teaser.tpl

texts:
i'm on drupal 7.x, i have simple terms without subterms to display on my custom content type (node and teaser templates).

It should be easy to do, but i don't understand how to display them, i tried many things like :

$term = current($node->taxonomy);
echo '
' . $term->name . '
';

or

<?php print render($content['field_tags']); ?>

or

<?php   $term = current($node->taxonomy);
    print  '
name.'">' ;
   ?>

and other, and i get no result.

Could someone give me a clue ? thanks in advance !


texts: ajax modified form drop down doesn't save

texts:
I have used form_alter to add a ajax callback to an element to my form. When the user chooses an option, it creates dropdown options for the other field. However, while this works fine for changing the form, it doesn't actually save the value in the field when you click save. I checked the database and its not saved, value is 0. Not exactly sure what is happening.

Here is my code:

/**
 *  Implements hook_form_alter().
 */
function chapter_sponsor_levels_form_alter(&$form, &$form_state, $form_id) {
  if ($form_id === 'sponsor_node_form') {
    //we need to add an ajax call to the OG Group field on the Sponsor node page, so that it populates the sponsor level dropdown
    $form['og_group_ref']['und'][0]['default']['#ajax'] = array(
      'callback' => 'chapter_sponsor_levels_update_levels',
      'wrapper' => 'edit-field-sponsor-level',
      'method' => 'replace',
    );
    if(!empty($form['og_group_ref']['und'][0]['default']['#default_value']) && empty($form_state['values'])) { //if we are viewing the form not from an ajax request
      dpm($form);
      dpm($form_state);
      $gid = $form['og_group_ref']['und'][0]['default']['#default_value'];
      chapter_sponsors_levels_set_levels($gid, $form);
      dpm($form_state);
    }
    elseif (!empty($form_state['values']['og_group_ref']['und'])) { //if we have chosen a group
      //$gid = 8; //new york
      $gid = $form_state['values']['og_group_ref']['und'][0]['target_id'];
      chapter_sponsors_levels_set_levels($gid, $form);
    }
    $form['#submit'][] = 'chapter_sponsor_levels_save_level';
  }
}

function chapter_sponsors_levels_set_levels($gid, &$form) {
  $query = 'Select * from {og_vocab_relation} where gid = :gid';
  $results = db_query($query, array(':gid' => $gid));
  foreach ($results as $result) {
    $vid = $result->vid;
  }
  $chapter_vocab = taxonomy_vocabulary_load($vid); //get the vocabulary associated with the group
  if(!empty($chapter_vocab)) {
    $terms = entity_load('taxonomy_term', FALSE, array('vid' => $chapter_vocab->vid));
    $form['field_sponsor_level']['und']['#options'] = array('_none' => '- None -');
    foreach($terms as $term) {
      $term_names[$term->weight] = $term->name;
    }
    ksort($term_names); //sort the terms by their weight and set them as the dropdown values
    foreach($term_names as $name) {
      $form['field_sponsor_level']['und']['#options'][] = $name;
    }
    $form['field_sponsor_level']['und']['#title'] = $chapter_vocab->name;
  }
}

EDIT: Forgot to add this in to the post

function chapter_sponsor_levels_save_level(&$form, &$form_state) {
  dpm($form_state);
}
/*
 * AJAX callback when click on OG Group field on Sponsor page
 */
function chapter_sponsor_levels_update_levels($form, $form_state) {
  return $form['field_sponsor_level']; //update the sponsor_level field with the new dropdown values
}

EDIT:
I may be getting closer, but not yet there. I realized that if its not saving the value, its proabably because it doesn't match a list of allowed values. While I didn't see such a constraint in the database, I found a 'allowed values' list in the $form_state array. I modified my code above:

foreach($term_names as $name) {
      $form['field_sponsor_level']['und']['#options'][$name] = $name;
      $form_state['field']['field_sponsor_level']['und']['field']['settings']['allowed_values'][$name] = $name;
    }

However, now when I try to save the form when choosing a value, it says that it is an illegal value. I found that it was throwing the error from line 397 in the list module - for some reason, its not passing the 'allowed values' test.


texts: How can edit a menu on profile installing?

texts:
I want to edit Management Menu in drupal7 when my profile is installing and active expanded check mark in Administration item.
i user this method:

db_update('menu_links')
->fields(array('expanded' => 1))
->condition('menu_name', 'management')
->condition('link_title', 'Administration')
->execute();

but do not see any action!!! not work! plz help.


texts: Paging a view based on a grouping field?

texts:
I'm upgrading a site I created 2 years ago from D6 to D7. In that site, I have a view of items that are grouped according to year, so that the items for each year show up on a separate page -- you pass the view the year, and it displays the appropriate nodes for that year.  I need to have "previous year" and "next year" links, which would link to pages that show the nodes for the previous or next years, as appropriate.

I did this in the old (D6) site by allowing the header to display PHP code (using the PHP filter), doing math on the passed-in "year" parameter, and writing out the link to the next and previous years as raw HTML.  This feels wrong - very un-Drupal — but I can't figure out how to get views to do it more natively.

My feeling is that I'd like to use something like the grouping field (from "Format/Settings") except that instead of just putting a heading between the grouped nodes (which in my case would result in a page with over a thousand nodes displayed) it would split them into pages based on that grouping field.

Any ideas?

I found some items that point to a possible answer.  There's this previous question:

Views pagination based on taxonomy terms

My years ARE also taxonomy terms, so this would work for me if the question was ever answered as asked.  While there is no actual answer, there is a pointer to this very nice Earl Miles article:

http://drupalwatchdog.com/1/1/how-to-create-new-features-in-views-3

That is VERY close to my use case, and I guess if I have to I can try to create a Views Plugin based on Earl's instructions, but I'm hoping for something simpler.  I'd rather use a plugin than write one!

(In the article, Earl says the code for the plugin could be found at http://drupal.org/project/views_plugin_examples, but when I go to that project it appears to be empty.)

In any case, this looks like a "solved problem" -- but I can't find the solution!  Any pointers, before I re-invent the wheel?


texts: Drupal 7 View tab on user profile empty as default?

texts: In a default Drupal 7 installation where no custom fields were been added to user profiles is it the normal behavior that the user profile tab View is empty? I would expect to see for example the registration email. Thank you all for help


texts:
I have been trying to use the Image EXIF Autorotate Module. I have installed all the required modules like

Imagecache Autorotate
Original image with style

Also changed the image field property

Apply style to image after upload = Image EXIF Autorotate

Nothing is happening I upload the image and no changes and it just upload the image as it is and if I try to rotate it manually nothing happens.

My requirements are as the image is uploaded the user sees the image and if wants to rotate it by clicking on it to do so.


texts:
I've got a view with 5 complex view displays (4 pages and 1 feed).

I've also got another view with 7 even more complex view displays which where automatically generated from the calendar module.

Is it possible to merge those 2 view displays into the same view? Or alternativelly execute Add view from template within an existing view. So the 7 calendar view displays ends up appended in the view which already contains my 5 custom view displays.

What I've tried so far:

Add view from template in a new view and replicate/recreate by hand my custom 5 displays
export the 2 views with features and try to merge the code so I can "features revert" to a single view

Is there a better way?


texts: Do these modules integrates with each other?

texts:
I'm using the Webform Access module (which is part of the Webform module) to allow multiple groups of users review webform submissions. The Webform Access module contains a block, Webform access group entities, that displays links to the group controlled webform nodes the user has access to.
I would like to use a view instead of the block to allow for more flexibility in the way the links are presented.
I have not been able to achieve this, it seems the Webform Access specific fields are not exposed to views.
I have installed Webform Views but that module seems to lack support for Webform Access too.
Is this currently not possible or am I missing something here?
I'm using Drupal 8.9.7 and Webform 5.22.
Thanks.


texts:
In the event of an emergency I would like the site administrator to push a message to all screens (to any anonymous viewer on any page). The push should not require the visitor to refresh their page or visit another page. The message must push out to all pages without requiring the viewer to take action.

Perhaps after a cron run?

Additional nice-to-haves:

the message is a node of a specific content type
upon creating this node, the author must "activate" the node before the message is live

Any suggestions?


texts: How to change image style using hook_views_pre_render()

texts:
I am trying to adapt the following Drupal 7 code to Drupal 8, in order to set a different image style to every image in a view:

// Assigns a random style name to each image
function <MODULE_NAME>_views_pre_render(&$view)
{
  if($view->name == 'SOME VIEW')
  {
    $styles = array('thumbnail', 'medium', 'large');
    foreach($view->result as &$result)
    {
      $result->field_field_image[0]['rendered']['#image_style'] = $styles[array_rand($styles)];
    }
  }
}

Right now I have:

function <MODULE_NAME>_views_pre_render(ViewExecutable $view)
{
  if($view->id() == 'SOME VIEW')
  {
    $styles = array('thumbnail', 'medium', 'large');
    foreach($view->result as &$result)
    {
      $image = $result->_entity->get("field_media_image");
      $image->SOME_FUNCTION('#style_name') = $styles[array_rand($styles)];
    }
  }
}

However, I can't figure out what SOME_FUNCTION would be -- There does not appear to be any way to access the render array from an ImageItem object.


texts: Creation of products completely except the admin

texts:
I am using Drupal Commerce and I need to let my users to create products without the product display.

I thus adjusted the permissions, but when a user creates a product, 1/ the url is the one of the admin admin/commerce/products/add/1 and 2/ once the created product, the user has a access denied.

My question: how to let the users to create products completely except the admin (modification of the url etc.) ?


texts: Drush without SSH access on remote server

texts:
Following my previous question, I plan to duplicate my website so that I have a production website and a staging site. I am going to have the staging site on a local version on Ubuntu, and it was recommended that I use Drush to keep them synced. Installing Drush locally should be no problem since I will be the full, and only, administrator. However my production site is hosting using shared hosting and the hosting company do not allow access to SSH, I have asked. Is it still possible to use Drush to sync the sites, and if so, how?

If however it is not at all possible, I would appreciate if you could suggest an alternative way of achieving the same thing please.

I'll admit that I'm diving in at the deep end here. I think I pretty much know what it is, however you can't say I'm too familiar with it.

Thanks in advance


texts:
I can print a field in content type tpl file with this:

<?php echo render($content['field_name']); ?>

But how can I print the field as a different display mode?

EG I might always want to print the teaser version of an image field, regardless of what view mode is being used.


texts: Organic Groups Support for Context Module

texts:
I would like to achieve following functionality.

In Context Conditions check Group Type such as Pubic, Private, Moderate
Check User is member of a Group or Not !

Is it possible using any module ?? I verified Context OG module but it's not giving options that i am looking for !

Any solutions to override the context and check for above conditions ?


texts: Form Validation. Ensure Placeholder is not submitted value

texts:
I have a Drupal registration form with a placeholder set on a first name field. I am trying to get the form to check so that if the placeholder value is the same as the submitted value it will give an error asking them to be sure to enter their first name. Here is my code:

function mytheme_form_alter(&$form, &$form_state, $form_id){
  if ($form_id == 'user_register_form'){
    $form['field_first_name']['und'][0]['value']['#default_value'] = t('First Name');

    $form['field_first_name']['und'][0]['value']['#attributes']['onblur'] = "if (this.value == '') {this.value = 'First Name';}";
    $form['field_first_name']['und'][0]['value']['#attributes']['onfocus'] = "if (this.value == 'First Name') {this.value = '';}";
    // Alternative (HTML5) placeholder attribute instead of using the javascript
    $form['field_first_name']['und'][0]['value']['#attributes']['placeholder'] = t('First Name');

    $form['#validate'][] = 'parenting_validate_register_form';

    $form['actions']['submit']['#value'] = t('JOIN US FREE');
  }
}

function mytheme_validate_register_form(&$form, &$form_state) {
  if ($form_state['values']['field_first_name'] == 'First Name') {
    form_set_error('firstname', t('Please enter your first name.'));
  }
}

So the problem I am having is that with the above, every submission is throwing the error. Even if something other than "First Name" is entered. For some reason if ($form_state['values']['field_first_name'] == 'First Name') is returning true no matter what the "field_first_name" value is.

I've looked into using https://drupal.org/project/clientside_validation, but it just seems like overkill for what I'm trying to do.

Thanks for any help.


texts: How can I export a list of users including their Content Profile data?

texts:
I need to export the user list including Content Profile data to excel. I tried a couple of modules (like "views data export") but I can't get them to work and the documentation doesn't exist...

I understand that the best starting point is views (I created a query with the wanted fields), but I don't know where to go from there.

Can you please help me?

Thanks


texts: Homebox column number different on mobile?

texts:
I have created a 3 column homebox site with rss feeds in an attempt to roll my own replacement for google ig (which is to shut soon). It works perfectly for what I want. Is there a simple method to serve up a 1 column version of the same site to mobile users? I have been investigating browscap and adaptive theme (AT) but I was hoping there was a simple method of serving the same site with 1 column instead of three (must use homebox)?

Desktop:

Mobile:


texts:
I want to set the cache settings for a block that I build by module.
I know how to set the cache settings for the build array, but I am not able to find a possibility to modify the cache of the block itself. (label / twig)

The theme of the block does output a form by receiving an array. This array is language specific. I need to set the cache to "language specific" or turn if off completely. But how?

Thanks.


texts: How to Post JSON data to Cart service in Drupal Commerce Services

texts:
I'm uses Drupal commerce services for mobile commerce. But I don't know how to Post jSON to REST service Cart or Order. With Comment services I"m post JSON successful as below:

URL: [http://myserver.com/services/comment/][1]
METHOD: POST
JSON BODY:
{
    "comment":{
      "comment_body":{
        "und":[
          {"value":"Good job"}
        ]
      },
      "nid":"23",
      "subject":"Drupal Services Comment"
    }
}

I don't know what is JSON Body to POST to Cart or Order Service like that? Anyone Please help me? Thanks


texts:
For various reasons I am currently working on a module with a version of jQuery and jQuery UI that is not core. In other words,

scripts[]=js/jquery.js
scripts[]=js/jquery-ui.js

are declared in the .info file. While this gives me the correct look and feel of my module, the form callbacks I used previously with Drupal.behaviors are not working anymore.

My first approach was to remove the (function($) {...})(jQuery); enclosures in the Drupal.behaviors function, to no avail.

My question is then: Is there a way to write these callbacks using standard (non-Drupal) jQuery or do I have to refactor everything 'the drupal way?'

Here is what I have on the .module side:

function        ggent_form($form, &$form_state) {

$form['Input type'] = array(
    '#type'=>'fieldset',
    '#title'=>'Upload your image'
);

$form['Input type']['file'] = array(
    '#type' => 'managed_file',
    '#title'=> t('Upload image'),
    '#description' => t('An optional description'),
    '#upload_validators' => array(
        'file_validate_extensions' > array('gif png jpg jpeg'),
        'file_validate_size'=>array(512*512*512),
    ),
    '#upload_location'=>'public://',

);

$form['Input type']['submit'] = array(
    '#type'=>'submit',
    '#value' =>t('Submit'),
 '#ajax' => array(
            'callback'=> 'ggent_update_image_callback',
            'wrapper'=>'mywrapper'
        ),
);

return $form;
}

///*
// * Form callbacks
// */
function        ggent_update_image_callback($form,$form_state) {
$picture_settings = array(
    'image' => file_create_url($form['Input type']['file']['#file']->uri)
    );
    drupal_add_js(array('ggent' => $picture_settings),'setting');
    return;

Which should send to my .js file to be used as:

    if (input_type === 'image') {
        img.src = '....../standardbg.png';
        Drupal.behaviors.imgupload = {
            attach: function( context, settings ) {
                if (typeof Drupal.settings.ggent.image!=='undefined' && img.src !== Drupal.settings.ggent.image) { //typeof img.src !== 'undefined' &&
                    img.src = Drupal.settings.ggent.image;
                }
            }
        };
    }

But this doesn't work. The Drupal.behaviors event doesn't fire at all! Any suggestions would be greatly valued.
EDIT: Updating my jQuery using the suggested module does nothing.


texts: Turn off revisions for content types that contain certain types of fields (e.g. Field Collection)

texts:
The Field Collection module does not support revisions. Yes there are lots of patches which are still under review. But what I want to do is create a module that on the node edit screen, queries the fields of the content type and removes the Revision Information tab (or disables the "Create new revision" checkbox) if the content type has one or more Field Collection fields. Any help on how which hook to use, how to query the fields of a node, and how to disable the revisions tab would be very helpful. This module needs to be applied to hundreds of sites.

Thanks to pcambra, here is my module:

function epc_no_revisions_for_fc_form_node_form_alter(&$form, $form_state) {

    $collection_fields = field_read_fields(array('type' => 'field_collection'));

    foreach($collection_fields as $FC){
        if(isset($form['#node']->$FC['field_name'])){
            $form['revision_information']['#access'] = FALSE;
            drupal_set_message("This node cannot accept revisions because it contains the following Field Collection: " . $FC['field_name'],'status');
        }
    }
}

UPDATE:

The above module didn't handle a fresh node where the fields had not yet been set. So I revised it to first load all the fields in the database and see if any belong to the bundle (content type) in question:

function epc_no_revisions_for_fc_form_node_form_alter(&$form, $form_state) {
    if(_epc_no_revisions_for_fc_test_for_fc($form['#node']->type)){
        drupal_set_message("Please note: This node cannot accept revisions because it contains a Field Collection",'status');
        $form['revision_information']['#access'] = FALSE;
    }
}

function epc_no_revisions_for_fc_node_presave($node) {
    if(_epc_no_revisions_for_fc_test_for_fc($node->type)){
        if($node->revision == 1){
            $node->revision = 0;
            drupal_set_message("No revision was created because the content type contains a Field Collection",'status');
        }
    }
}

function _epc_no_revisions_for_fc_test_for_fc($node_type){
    $fields = field_info_fields();
    foreach($fields as $field){
        if($field['type'] == 'field_collection'){
            foreach(array_shift($field['bundles']) as $content_type){
                if($node_type == $content_type){
                    return true;

                }
            }
        }
    }
    return false;
}


texts: Add image by pasting URL with media module

texts:
In the screenshot, you can see I have the option to upload a video by URL. This is provided with the media module and the video embed field module.

Is there a similar module for adding images by pasting a URL. Or will this need to be a custom solution?


texts: I have a nodes, and a few vocabularies to choose terms from. I would like to show images of terms from specific vocabulary in nodes (If node is associated with term from specific vocabulary, it would show image from that terms field). What would be the best (most "Drupal") approach to this? :)


texts: How to get the field and value of a content type in drupal 8?

texts:
I wanted to create a module that fetch the entire data from my custom content type to  generate a json file. So I used the function

$values = \Drupal\Core\Entity\ContentEntityBase::get('field_name');

to read the field and its values of a content type. Any way to dynamically fetch all the fields and its values. Any solution?
Thanks in advance..:D


texts: How to make profile fields based on conditional role selection before account creation?

texts:
I'm using Drupal 7.23, autorole module and Profile2 to expand the user profile based on role.

In my setup, each role has a different set of fields available to them after they sign up.

What I'd like to do is display those field sets based on the role they select while signing up, rather than asking them to edit their profiles after account creation.

Is it possible to display the field sets based on the role radio button that is selected before the user account is created? if so, how would I do this?


texts:
I have tested tried out a couple of image-cropping modules listed here. None of them seemed to meet my expectation, but chances are I was doing something wrong. That's why I'm looking for your experience.

What I want is to enable the admin-to-be to manually select the area and crop uploaded images to a square based. I don't want to rely on automatic scale-and-crop effect provided by Drupal as it may trim the image inappropriately. So, I'd expect the module to offer a per-instance cropping.

Has anyone encountered that kind of capabilities?


texts: Use functions: uc_file_user_downloads function and theme function

texts:
I would like to print files user download from ubercart on  a new page. I find this theme function "uc_file_user_downloads" but i don't know how to use it.

To print the table i write this little code:

<?php

 print $user->uid;
 $account = $GLOBALS['user'];
 print theme('uc_file_user_downloads', $account);
?>

And the result i have:

  26 Fatal error: Cannot use object of type stdClass as array in
  /code/includes/theme.inc
  on line 1070

Could you explain me the correct way to pass the parameter on this function. I tried to cast the stdclass to array but this is not working.


texts: When should the second drupal_bootstrap() parameter be used?

texts:
The parameters accepted from drupal_bootstrap() are two; the second is defined as follows:

  $new_phase: A boolean, set to FALSE if calling drupal_bootstrap() from inside a function called from drupal_bootstrap() (recursion).

I am not clear what that means, considering that statistics_exit() calls drupal_bootstrap() using just one argument, thus using the default value (TRUE) for the second one.
hook_exit() is invoked from _drupal_bootstrap_page_cache(), and statistics_exit() should be considered a function called from drupal_bootstrap() that calls drupal_bootstrap().

Yet, statistics_exit() is not using FALSE as second argument of drupal_bootstrap().

The only functions I found that use FALSE as second parameter are module_hook_info(), and _drupal_bootstrap_page_cache(), which contain the following code.

  // module_hook_info()
  // This function is indirectly invoked from bootstrap_invoke_all(), in which
  // case common.inc, subsystems, and modules are not loaded yet, so it does not
  // make sense to support hook groups resp. lazy-loaded include files prior to
  // full bootstrap.
  if (drupal_bootstrap(NULL, FALSE) != DRUPAL_BOOTSTRAP_FULL) {
    return array();
  }

  // _drupal_bootstrap_page_cache()
  // Check for a cache mode force from settings.php.
  if (variable_get('page_cache_without_database')) {
    $cache_enabled = TRUE;
  }
  else {
    drupal_bootstrap(DRUPAL_BOOTSTRAP_VARIABLES, FALSE);
    $cache_enabled = variable_get('cache');
  }

From the code of the first function I could understand I should use FALSE when I need to get the current bootstrap phase, and in that case I would use NULL as first argument.
From the code of the second function, I could understand that the second parameter is an internal parameter, I should not pass in my functions, as the only case a function of mine is being called from drupal_bootstrap() (also indirectly, through a function that is called from drupal_bootstrap()) is when I implement hook_boot(), or hook_exit().

Did I misunderstand what said in the drupal_bootstrap() documentation? If it so, when exactly should a call to drupal_bootstrap() use a value for the second parameter that is different from its default value?


texts:
I wish to create a taxonomy where the administrator users limit which terms can be tagged.

Suppose I have a vocabulary containing the following terms:

Football
Golf
Snooker

I want the tag autocomplete to show the tags that can be used. If I typed "Foo", the autocomplete should show "Football"; if I typed "Basketball," the autocomplete would not show anything, the node would submit, but no term is created.

Is this possible?


texts: Drupal 8: when I enter a Clean URL, it converts to node format in the URL. How to show the clean URL and not the node URL?

texts: What could be causing a switch to show the node in the URL rather than the alias? When I type in the clean URL rather than the node, the browser goes to the page just fine. It just shows the node in the URL.  rewrite_module seems to be installed as it is shown when I use httpd -M. My .htaccess file is the same as the head of Drupal. I am running Centos7. In my apache conf file,  have AllowOverride All for the location that my .htaccess file is in.


texts: How to set value to an unlimited field collection using Rules?

texts:
I want to copy the values of the field collections from entityform to node form, using the Rules module.

I tried to loop my field collection, then set value of the field collection from entityform to entitycreated, but this didn't work. I only get blank fields but the number of field collections are the same.

For example I have 5 field collection items per field collection and 5 field collections from entityform, after executing the rule I also have 5 empty field collections on the entitycreated.

Here's a sample of the rule:

{ "rules_after_submitting_entityform_custom_package" : {
"LABEL" : "After submitting entityform Custom package",
"PLUGIN" : "reaction rule",
"OWNER" : "rules",
"REQUIRES" : [ "rules", "entityform" ],
"ON" : { "entityform_update" : [] },
"IF" : [
  { "data_is" : { "data" : [ "entityform:type" ], "value" : "custom_package_entity_form" } }
],
"DO" : [
  { "entity_create" : {
      "USING" : {
        "type" : "node",
        "param_type" : "sample",
        "param_title" : "Your Event",
        "param_author" : [ "site:current-user" ]
      },
      "PROVIDE" : { "entity_created" : { "entity_created" : "Created entity" } }
    }
  },

  { "LOOP" : {
      "USING" : { "list" : [ "entityform:field-option-criteria" ] },
      "ITEM" : { "list_entity_form_option_criteria" : "Current list item" },
      "DO" : [
        { "data_set" : {
            "data" : [ "entity-created:field-option-criteria" ],
            "value" : [ "entityform:field-option-criteria" ]
          }
        }
      ]
    }
  },
  { "data_set" : {
      "data" : [ "entity-created:field-entityform-referenced" ],
      "value" : [ "entityform" ]
    }
  },
  { "entity_save" : { "data" : [ "entity-created" ] } },
  { "redirect" : { "url" : "[entity-created:url]", "destination" : "1" } }
] }}

Any idea, how to set this the right way?

Also, after creating this rule, I get this error when trying to delete the node created:

  Fatal error: Call to a member function delete() on a non-object in /sites/all/modules/field_collection/field_collection.module on line 830

I also tried using the Entity reference autofill module but it's not auto-filling the fields if I try it with Rules.

Any suggestions?


texts: Load scripts in the head AND bottom of the page?

texts:
I need to load head.js in my head and application.js at the bottom of my page. The following seems to stop all my scripts being loaded! Is there a syntax error? Im confused as I used the documentation from here:

https://www.drupal.org/docs/8/theming-drupal-8/adding-stylesheets-css-and-javascript-js-to-a-drupal-8-theme

global:
  version: 1.x
  css:
    base:
      /ui/style.css: {preprocess: false, minified: false}

  js-header:
    header: true
    js:
      /ui/head.js: {preprocess: false, minified: false, weight: '-100'}

  js-footer:
    js:
      /ui/application.js: {preprocess: false, minified: false, weight: '-99'}

UPDATE - It appears to me that header: true is used to move either all or none of the scripts to the head. Can someone confirm if this is right?

If this is the case, how can I load scripts in both the head and the bottom of the page?


texts: Using a computed field: How to extract a field value from a referenced node into field collection. (Multiple value)

texts:
I have written this code inside a computed field, which has given me as result,
the referenced entity numbers how are saved in the field as an array.

I would like to know how to extract from the entity number a specific field, such as the title.

foreach ($entity->field_campos as $field) {
}
foreach ($field as $index => $valores) {
$terminos[] = $valores['value'];
}
$item2 = field_collection_item_load_multiple($terminos, $reset = FALSE);
foreach ($item2 as $indice => $values) {
$entity_field[]['value'] = $values->field_nombre_2['und'][0]['target_id'];
}

// Display code (PHP).
$display_output = $entity_field_item['value'];

I am using Drupal 7.


texts: Add a custom action on admin content page

texts:
I want to add a custom action to the dropdown on the admin content page (/admin/content) as shown in the screenshot below using Drupal 9. The views module is enabled so that form is part of the view.

I have found that actions are now plugins so I should just need to create a new plugin for my custom action.
I've used the actions found in /core/lib/Drupal/Core/Action/Plugin/Action/ as an example for my new action so just created a new plugin that extends EntityActionBase add added the relevant methods.
I have a custom module called shop_scrape.
I created the file shop_scrape/src/Plugin/Action/ScrapeAction.php
That file contains:
<?php

/**
 * @file
 * Contains \Drupal\shop_scrape\Plugin\Action\ScrapeAction.
 */

namespace Drupal\shop_scrape\Plugin\Action;

use Drupal\Core\Access\AccessResult;
use Drupal\Core\Action\Plugin\Action\EntityActionBase;
use Drupal\Core\Annotation\Action;
use Drupal\Core\Annotation\Translation;
use Drupal\Core\Entity\EntityTypeManagerInterface;
use Drupal\Core\Session\AccountInterface;
use Symfony\Component\DependencyInjection\ContainerInterface;

/**
 * Scrape a page.
 *
 * @Action(
 *   id = "entity:scrape_action",
 *   label = @Translation("Scrape a page"),
 *   deriver = "Drupal\shop_scrape\Plugin\Action\EntityScrapeActionDeriver",
 * )
 */
class ScrapeAction extends EntityActionBase
{

  /**'
   * ScrapeAction constructor.
   * @param array $configuration
   * @param $plugin_id
   * @param $plugin_definition
   * @param EntityTypeManagerInterface $entity_type_manager
   */
  public function __construct(array $configuration, $plugin_id, $plugin_definition, EntityTypeManagerInterface $entity_type_manager)
  {
    parent::__construct($configuration, $plugin_id, $plugin_definition, $entity_type_manager);
  }

  /**
   * {@inheritdoc}
   */
  public static function create(ContainerInterface $container, array $configuration, $plugin_id, $plugin_definition)
  {
    return new static(
      $configuration,
      $plugin_id,
      $plugin_definition,
      $container->get('entity_type.manager')
    );
  }

  /**
   * {@inheritdoc}
   */
  public function executeMultiple(array $entities)
  {
    foreach ($entities as $entity) {
      \Drupal::messenger()->addMessage('Scrape ' . $entity->id());
    }
  }

  /**
   * {@inheritdoc}
   */
  public function execute($object = NULL)
  {
    $this->executeMultiple([$object]);
  }

  /**
   * {@inheritdoc}
   */
  public function access($object, AccountInterface $account = NULL, $return_as_object = FALSE)
  {
    $access = AccessResult::allowed();
    return $return_as_object ? $access : $access->isAllowed();
  }

}

Then I also created a EntityScrapeActionDeriver that for now just returns true:

<?php

namespace Drupal\shop_scrape\Plugin\Action;

use Drupal\Core\Entity\EntityTypeInterface;

/**
 * Provides an action deriver that finds scrapable entity types.
 *
 * @see \Drupal\Core\Action\Plugin\Action\PublishAction
 * @see \Drupal\Core\Action\Plugin\Action\UnpublishAction
 */
class EntityScrapeActionDeriver extends EntityActionDeriverBase {

  /**
   * {@inheritdoc}
   */
  protected function isApplicable(EntityTypeInterface $entity_type) {
    return true;
    //return $entity_type->getLabel() == 'page';
  }

}

But my custom action is not appearing. Are there other steps I need to take or have I done something wrong?


texts: How to prevent Drupal export XML formatter adding paragraphs?

texts:
I'm exporting nodes as XML and with fields in most nodes set to "Plain text" format. Everything is fine when I'm editing them, but when exporting an extra paragraph (
) tag is added around text (using "Default" formatter).

The mentioned field has a variable length text (some are short like "Book" and some have long HTML). Some longer texts are exported fine, but those short ones all have extra paragraph around them (e.g.
Book
).

So is there some option I can check to disable adding those paragraphs or even disable any formatting? Or maybe I have to install/make some special module for formatting?

PS: I'm using Views data export (version 7.x-3.0-beta8).


texts: I have a third party library located in the root/libraries directory, but it is not called on my webpage. I was wondering using subtheme/subtheme.theme or subtheme.libraries.yml. I call it from here? Any information would be great, I can't find documentation on third party libraries for Drupal 8.


texts: Generate js variable before javascript loaded

texts:
I have a block with invocation code inside(it invokes js code from OpenX ads server), my site is responsive and this block get cloned(with jquery .clone() function) on ipad or iphone version of the site. So to avoid calling the invocation js code 2 times i need to set js variable (like this - > window.isScriptLoaded = FALSE) and then inside my block i can easy do next thing:

if (window.isScriptLoaded == FALSE) {
    window.isScriptLoaded = TRUE;
    //invocation code...
}

in this case all working fine, i can easy add this variable to any js file in drupal.

But in my case admin can add new block and insert new invocation code - SO I need to generate window.isScriptLoaded2 and output this variable BEFORE code in block is loaded

i tried next thing

function HOOK_page_alter(&$page) {
  //get all the variables
  //i generate my variables in database
  $var = db_query("SELECT * FROM {banners}")->fetchAll();
     $full_array = array();
     foreach($var as $object) {
         //for example Anyvariable = FALSE;
         $array[$object->name] = $object->value;
     }
      drupal_add_js(array('common' => array(
    'vars' => $array,
    )), 'setting');

}

this works but, code in block is loaded before drupal.settings.vars.Anyvariable is loaded.
So my variables is always false


texts: how to convert node_uri (array) to url string

texts: I used a function node_uri($node) get an url array. how to change it to a string?


texts:
How do you create a block with multiple dynamic links? If the url is http://www.domain.com/series/bomberman-jetters/node/add/gallery/82 then the 82 is varied depending what node your viewing.

Also another link http://www.domain.com/series/bomberman-jetters/node/add/gallery/82 again the 82 is varied. I want these 2 dynamics link as a button link in a block. How can I do this? This is for Drupal 7


texts: Save me from changing the look of CKEditor using Javascript

texts:
I see that code is being rendered to produce this CKEditor (via the CKEditor module) contains an inline style that creates a height of 200 pixels. I'd like to change this value to 100px to save a bit of screen space.

I would like to change this or override this is a maintainable way. In the hopes it was in a tpl.php I tried find . -name '*.php' -exec grep -lin 'presentation' {} \; with little luck.

Can anyone point me to where can override this value? Or better put, how can I do better than this:

jQuery(function() {
        console.log('Resizing ckeditor')
        jQuery('#cke_1_contents').attr('style', 'height: 100px; max-height: 100px;');
  });


texts: I decided to programatically print comments un Views using PHP footer. The problem is that they now appears twice (my code + default). When I disable comments in content type settings, both ddisappear. How can I disable the default comments and keep my comments printed by php code? I tried to edit node.tpl file. but there is no section responsible for showing comments there (I use Garland). Any advice appreciated.


texts:
I am trying to find a way to build simple affiliate price comparison website.

Parsing feeds with the FEEDS module is really easy and straightforward. But I have some problems regarding the duplicate products from different vendors. What I want is to manually map those duplicates into one page, so I can list all different price variations by each vendor in just one page. e.g: one nokia lumia 1020 show prices from different vendors amazon, bestbuy etc.

I couldn't find any module in drupal's site but I am quite sure I am missing some important point in here. I would be glad if you could help or guide me through.


texts: How to change the price componnents order in the order total field view

texts:
I have a commerce site, I want to change the price componnents order of total order field in the order view page.

In the edit order page the last added line item -fee in my case , I add them manually- become the first in the in the price componnents field, I want do the inverse.

I didn't find any view to edit the added line items order. So I want to ask if there is a way to do that.


texts: How to set permission for exposed filter in Views block

texts:
I have a View with several blocks or displays. In one of these displays I have added the filter "Published" and made it exposed, so that user can switch between published and unpublished content.

Now I only want users with the administrator role to be able to see this filter, but I cannot figure out how to do this.
Can anyone give me a hint?

Thanks in advance


texts:
Could anyone show me how to customize welcome email in Drupal 8, as I spend a lot of time trying to get it done.

I've already tried in Back Office but Drupal seems to ignore it totally.


texts: Create a new region within an existing one

texts:
I want to create a new region within an existing region which is by default or is custom made. I have created a custom region called footer_top. I want to create a new region within this region, i.e, a nested region. What should i do...what code should i write in page.tpl.php and how?

Thanks


texts: Dynamic form fields using #states array on empty select field

texts:
Trying to make the second field only visible when there is a value in the first controller field. If nothing is selected in the initial load of the screen, the second field should be hidden.

Because the controller api_title is a sub array I'm not sure how to set the comparison value in condition name='api_title'

$form['api_title_filter_widget'] = array('#tree' => true, '#weight' => '10');
$form['api_title_filter_widget']['api_title'] = array(
        '#type' => 'select',
        '#title' => 'API Title',
        '#default_value' => $api,
        '#options' => ["" => "- Select -"] + $published_api_proxies,
        '#ajax' => array(
            'event' => 'change',
            'callback' => 'callback_api_product_filter',
            'method' => 'replace',
            'wrapper' => 'api_products_controlled_by_filter',
        ),
    );

$form['api_product']['#states'] = array(
                                   'visible' => array(
                                        '**select[name="api_title"]' =>**
                                          array('!value' => ''),
                                            ),
                                         );


texts: Avoid new user notification on user_save

texts:
I'm currently importing a whole bunch of users to a site programmically through user_save. How can I make sure that no registration mails are sent to the users?

// Create new user
$newUser = array(
    'name' => $member->name,
    'pass' => $member->password,
    'mail' => $email,
    'field_user_fullname' => array('und' => array(array('value' => $member->navn))),
    'status' => 1,
    );
user_save(null, $newUser);


texts:
I have a content type 'company' with a related tax-term: 'city'.
With a view I can search for companies based on 'city' with autocomplete.

Is there a way I can relate adjacent cities into the same tax-term 'city'?
If not, I would have to create a new tax-term into the content type 'company' and select for each company the adjacent cities. That is a lof of work.

Geo lookup is not an option, because we want te select which adjacent cities belongs to a specific city.

For example:
Tax-term: city

City A
-- City B // adjacent city of 'city a'
-- City C // adjacent city of 'city a'
-- City D // adjacent city of 'city a'
City B
City C
City D

As you can see, City B, C and D exists in the tax-term but also are children of 'city A'. It should be an alias, because otherwise the children will have all a different ID, so that won't work.

Hope it is clear ...


texts: Workbench moderation state tab not displayed

texts:
My "Authenticated User" can not see the tab "Publishing options" on the node/add/[content type] page. What I need in my workflow is the user to select the moderation state (Draft/Moderation) the node should be in, but he can't see the tab.

I have 3 moderation states: Draft, In Moderation, Published.

The user has the following permissions:

Node:
    View published content
    View own unpublished content
    View content revisions
    create [content type] content
    edit own [content type] content
    edit any [content type] content
Workbench Moderation:
    View the moderation messages on a node
    Use "My Drafts" workbench tab
    View all unpublished content
    View moderation history

I configured the permissions looking at https://www.drupal.org/node/1175592 and https://www.youtube.com/watch?v=8nqWLrxH_4M + https://www.youtube.com/watch?v=qHYWOohhKZE

I don't know if there are other permissions that I forgot. I have already rebuilt the permissions on /admin/reports/status/rebuild, no difference.

Funny thing is that, if I assign all permissions

Moderate all content from Draft to in Moderation
Moderate all content from in Moderation to Draft
Moderate all content from in Moderation to Published

to the anonymous user, he still can't see this tab.

Any help welcome.


texts:
I recently upgraded Drupal from version 7.12 to 7.23. After the upgrade, I noticed that when downloading private files, I no longer get the correct filename when I select "Save As" in the browser.

These are the steps I follow:

I upload a file ("testfile.pdf") in a file field for a node
I view the node, right click the file and choose "Save As"
The filename in the download dialog (which should have been "testfile.pdf") now depends on the browser

Chrome: download.pdf
FF: [random string].pdf
IE: [domain name].pdf

I am using private files to be able to restrict access to files. In the release notes for Drupal 7.22, I read that a "Content-Disposition" header was removed from private file downloads.

Could this be the reason that private files no longer retain the filename when downloading?


texts:
I'm programmatically creating a table in Drupal 8, using #type => 'table'. I'm adding some HTML to a table cell, however the output is being escaped so that the HTML is rendered as plain text, rather than as HTML.

From everything I read, it sounds like all output in twig templates are escaped by default.

I'm guessing I can override table.html.twig, but I'm guessing (hoping) there is a way to do it when defining the table, rather than overriding the template each time I want to create a new table that has HTML.

Does anyone know how to use HTML in a table cell in D8?


texts: How can I build a Views with oEmbed Vimeo Thumbnails?

texts:
I have a content type that I'm using Media oEmbed and Media Vimeo to display and play videos in. What I want to do with the Views Module is create a View Page that shows the thumbnails of the video and uses the thumbnail to link the node.

The thumbnails are being uploaded into the public files through the embed process with the filename matching the Vimeo video ID, but I can't figure out what field to use or replacement sting to grab that Vimeo ID.

I have the videos in the content type, I have the thumbnails being stored locally on my server in my public files, I just don't know how to bring them all together with Views.


texts: How to trim view field to height or number of lines?

texts:
I have a div with a fixed height and want to display a view field.  When the content overflows the div, I'd like an elipsis to click for more.

CSS can handle overflow and hide it (and overflow-text can handle a single line) but I have to estimate everyting for number of lines since words can be an arbitrary length.  Sure views with or without the smart trim module can handle words or characters, but I need to estimate the number of lines or, ideally, I'd like the trim based on the max-height of a div.

The Smart Trim maintainer suggested a CSS library which may help but does not solve the problem.

I imagine that views text overflow based on height is a common problem.


texts:
How to get the URL of remote video inserted by media field in block or paragraph twig?
I am using the paragraphs module to create video galleries from youtube videos. When I use {{ content.video_gallery }} it's working and showing the youtube video thumbnail but I want to show this video in a popup for which I have written a code in which I need only the URL of the youtube video.
I am searching for two days I found solutions for image and video but no solution found for remote video URL.


texts: Entity reference Hierarchical Select between three content types?

texts:
I have three content types:

Courses
Sections
Chapters

Sections content type have Entity reference of Courses.

Chapters content type have two entity reference fields as Courses and Sections.

If I select the courses corresponding section I have to list out Chapters content type. I need a hierarchical structure.

How can I do that?


texts: Are there any other settings besides php.ini to allow file upload?

texts:
I have a problem with drupal upload file (core module) bigger than 1 MB. For images smaller than this, the upload run smoothly, the progress bar correctly shows the progress and when completed it display the uploaded images as expected.

However, when I tried to upload image bigger than 900 kb, the problem start to arise. The throbber progress indicator show progress until about 98% and then restart again from 0% and never completed and stuck.

In Firebugs it shows that the request was aborted when the progress reach 94%-98% depending on the size images I uploaded. And it only happend when the file > about 900 kB and never for smaller images.

I already changed the php.ini as suggested here and I verified through phpinfo() it is correct setting. I also change the max_input_time and max_execution_time in httpd.conf

In fact, when uploading images, I monitor temporary folder /tmp and it shows temporary file progressing from 0 to the size of the file and restarting from 0 again. Thus, it indeed receive the file, no issue on the size of the file.

I also check the permission, 777 on /tmp and 755 on default/files and it is no problem as I can easily upload 500kb images.

Can anyone help? is there any other settings in the server I have to look into?

Thanks


texts: Where are the "My Drafts" and "Needs Reviews" tabs?

texts: I am experimenting in simplytest.me to see if Drupal will suit our needs. I have been testing the workbench moderation module to get the work flow that will be required (content editors and then approval before publishing). I am running the default version of Drupal there (8.x-1.5) and want to see any items that are in draft or needs approval status. I am seeing reference to tabs that show me just that, however, I can not find the tabs anywhere. Is this something that has changed in the latest version or have I not ticked something or am I looking in the wrong place (was looking under "content" page)?


texts: Error while importing just exported content type with drupal console

texts:
I'm trying to export a content type from one drupal installation and then install it to another.

I export a content type with :

 ../vendor/bin/drupal cect

And then I try to import it to another drupal installation like this:

../vendor/bin/drupal ci --directory modules/custom/custom_module/config/optional/

This gives me the following error :

[ERROR] An error occurred while trying to write the config file: "Site UUID in source storage does not match the target
     storage.
     The core.extension configuration does not exist.
     Can not uninstall the Configuration module as part of a configuration synchronization through the user
     interface."

I thought it was just something with the other sites UUID but I get the same error if I try to import it into the site that I exported it from.


texts: How to update Geofield using a custom form and DrupalGap's node_save?

texts:
The code below successfully updates the title, but does not update the Geofield. The node_save function is provide by DrupalGap and described here http://api.drupalgap.org/node.js_.html

        var node = {
            'nid': nid,
            title : 'New Title', // THIS WORKS!!
            'field_geocoordinates[und][0][geom][lat]':tripchi.geocoordinates.coords.latitude.toString(), // NONE OF THESE DO
            'field_geocoordinates[und][0][geom][lon]':tripchi.geocoordinates.coords.longitude,
            'field_geocoordinates[und][0][geom][lat]':tripchi.geocoordinates.coords.latitude,
            'field_geocoordinates[und][0][geom][lat]':tripchi.geocoordinates.coords.latitude.toString(),
            'field_geocoordinates["und"][0]["geom"]["lat"]':tripchi.geocoordinates.coords.latitude.toString(),
            'field_geocoordinates["und"][0]["geom"]["lon"]':tripchi.geocoordinates.coords.longitude.toString(),
            'field_deal_count[und][0][value]' : 3, // simpler structure also does not update
            "field_geocoordinates": {
                "und": [
                    {
                        "geom": "POINT (2 1)",
                        "geo_type": "point",
                        "lat": tripchi.geocoordinates.coords.latitude.toString(), // I've tried this as strings and integers
                        "lon": tripchi.geocoordinates.coords.longitude.toString(),
                        "left": "2.000000000000",
                        "top": "1.000000000000",
                        "right": "2.000000000000",
                        "bottom": "1.000000000000",
                        "geohash": "s01m"
                    }
                ]
            }
        };
        node_save(node, {
            success: function(result) {
                console.log(result);
                utils.mAlert("Pinpointed Location to Latitude:" + tripchi.geocoordinates.coords.latitude + ' - Longitutde:' + tripchi.geocoordinates.coords.longitude);
            }, error: function(result) {
                utils.mAlert("UPDATE ERROR: " + result);
                console.log(result);
            }
        });

How should i be targeting custom fields in custom html forms / ajax update requests?

UPDATE:
@Jimajamma is correct in the comment below, but this only works when the property to update is value. It is not working on the Geofield module object shown in my code above.


texts: TB Mega Menu - how to open sub menu on click not hover (desktop version)?

texts:
For some reasons I need to open the mega menu when somebody clicks on a menu item - for the desktop version.

At the moment the mega menu opens with hover, I need a solution for click opening.

Is there any solution within the TB Mega Menu module for this?
If not, how can I realize this with JQuery?

Note: This is not a duplicate of "tb-megamenu how to click to open/close sub menu in mobile", because I need the click behavior NOT for mobile version but for desktop version.


texts:
How can i add a script file with type='module', like this :

<script src="site/test/test/index.js" type="module"></script>

I tried with :

  drupal_add_js(drupal_get_path('module', 'my_module') . '/assets/js/my_script.js', [
    'attributes' => ['type' => 'module'],
    'type' => 'module',
  ]);

But Drupal 7 only accept 'file', 'inline', 'external' or 'setting' as type.

Do you have any idea ?

Thanks.


texts: Translation of BlockBase (ConfigurablePluginInterface)

texts:
public function blockForm($form, FormStateInterface $form_state) {
    $form = parent::blockForm($form, $form_state);

    // Retrieve existing configuration for this block.
    $config = $this->getConfiguration();

    // Add a form field to the existing block configuration form.
    $form['Heading'] = array(
      '#type' => 'textfield',
      '#title' => t('Heading'),
      '#default_value' => isset($config['heading']) ? $config['heading'] : '',
    );

'#default_value' => isset($config['heading']) ? $config['heading'] : '',

can this thing be translated? And how?
I use it to display a text to site users


texts: How can I run a query in the views in the context of the user access?

texts:
How can I run a query in the views in the context of the user?
E.g. using EntityFieldQuery I can run

  $query->addMetaData('account', user_load(1));

is there any equivalent for $view->query?


texts: Using a class to call a call a custom drush service

texts:
I have created a drush service and I can use it on the command line, but I am trying to use dependency injection to use it from another class. However, it is saying that the service cannot be found. (From the public function __construct) All other regular services can be injected and used, except for the drush service. Can I inject drush services? Is injecting them different from other injection dependencies?

I have add the changes in the composer,json {extra}, created drush.services.yml and the Commands.php file. Everything works except the dependency injection.

I'm using Drupal 8, drush 9

thanks,

The NlmCommands.php file code

class NlmCommands extends DrushCommands {
.....
//drush test service
public function hello($name = , $options = ['msg' => FALSE]) {

if ($options['msg']) {
  $this->output()->writeln('Hello ' . $name . '! This is your first Drush 9 command.');
}
else {
  $this->output()->writeln('Hello ' . $name . '!');
}

}

Inject in TestInjection.php

/**
* inject service to form
* @var NlmCommands $hello
*/
protected $migration;

public function __construct(NlmCommands $hello) {
  $monthYear = '0118';
  $this->migration = $hello;

Error is 'call to non-existent service'


texts: How to change error message of the webform

texts:
Possible Duplicate:
  preprocess_node_webform is not working

How can I change the default error message of the webform ? For example "The name field is required"  to  "Please enter your name". Where should I make changes to achieve this ?


texts: How to get the current user id in the path

texts:
I'm using the Workspace module and when the user goes on their 'SITENAME/user', there's a link which leads them to all the nodes they have added.

The path of the link is 'workspace/<UID>' for example 'workspace/1' for admin. I'm trying to create another tab to do the same function but I can't figure out what path should I put. I tried 'workspace/%', 'workspace/user'. But nothing seems to work.


texts: How to create landing pages and Main Menu based on taxonomy

texts:
I'm trying to build a website for a non-profit which has multiple locations (~6) besides the headquarters.

The frontpage needs to be generic for the whole organization and will contain content from all locations.

However, each location needs have its own page ( not only the content part but also the main menu and the header etc.) and all the content(nodes etc.) associated with this location should use the same page template associated with this location. So I've created a taxonomy term for each location and tried to use template suggestions based on the term but it didn't work.

So far I was successful creating a panel page with its own path (such as website.org/headquarters) for each location and show content only for that location by filtering via the taxonomy term but no luck for having custom main menu or custom node pages for the location.

Is there something trivial that I'm missing or is there no easy solution for this?

Thanks,


texts:
My apologies if this is a duplicate, but I spent two days using my Google-foo to find this information and never did. So, now that I've figured it out, I'll post it here.

The Question

How do I turn off the body summary programmatically?


texts:
I have a form on my site. Each time a user submits the form they are directed to a confirmation page like this;

  eform/help-request/confirm?entityform_id=1

I want to create a view that has a contextual filter that picks the last form submitted by the user and displays the fields from that form only.

I have a view that shows the field content from the form as it was submitted by the user but i cannot get the view to only display the latest form submission from the user...
As i have it my view is displaying all the forms the user has ever submitted ... which i don't want.

Any help appreciated. I know I am close (ish)


texts: Showing two colorbox windows side by side...or within one main frame?

texts:
I have a site that I've created for some fellow musicians to learn new songs. Generally we have a link to a Youtube video of a song then a link that opens up the tab (chords, lyrics, etc) for the song. Right now I have links that open those things up individually in colorboxes. Works fine.

What I'd like to do is have one colorbox, or frame, or iframe, etc -- that opens up and in the left side I have the Youtube video and on the right side the tab colorbox ... so as I listen to the song I can scroll down at the same time and look at the tab. Here is a link to the site: http://practice.3cnorth.com/?q=all-songs

Thanks for any ideas.

ER


texts:
I use search api module and a view of products. If I put the search text block and I do a search, It redirect to an url like this:
 <my domain>?search_api_fulltext=word1+word2+word3&sort_by=title_1&sort_order=ASC

Where all search words are separated by a plus sign ("+").
I have my custom search block and I want to redirect to the same url in the submit function of the form. This is my code:

public function submitForm(array &$form, FormStateInterface $form_state) {

if (!empty($form_state->getValue('textBox'))) {
  $text = str_replace(' ', '+', $form_state->getValue('textBox'));
  $option = [
    'query' => ['search_api_fulltext' => $text,
                'sort_by'=>'search_api_relevance',
                'sort_order'=>'ASC'],
  ];
  $url = Url::fromUri('internal:/shop', $option);
  $form_state->setRedirectUrl($url);
}
return;

}

But it redirect to <my domain>?search_api_fulltext=word1%2Bword2&sort_by=title_1&sort_order=ASC, where plus signs are replaced with %2B, and then, the search is incorrect.
How could I avoid this replacement?


texts: Issue with "File Entity (fieldable files)" module. File Display not working for some users

texts:
I defined a content type called "concurso" which includes an "Image" field in it. The scheme for that field is Public Files. In fact, all files in my site are public.

In admin/structure/file-types/manage/image/display I set only the "File" field as visible.

In admin/structure/file-types/manage/image/file-display I set only the "Download link" option, establishing [file:field_file_image_alt_text] as the Download Link in the textbox below.

As a result:

It works correctly ONLY for Administrator, and users holding the File entity >> Bypass file access control permission. They see a link to the image with a text showing the ALT attribute of the image.
It doesn't work for other users (logged or not) not holding that permission. They always see a link to the image with the file name as the link text, ignoring the text manually set. It doesn't matter if I set a literal instead of the token [file:field_file_image_alt_text], drupal always show the filename of the image.

I'm stucked at this point and I can't figure out what I'm doing wrong.

Thank you for your help.

Drupal 7.31 -
File Entity (fieldable files) 7.x-2.0-beta1


texts: Do we have an option to change/override the drupalsettings variable which is defined by some other module through our custom module?

texts:
What is the best approach to change/override the drupalsettings variable which is defined by some other module (basically core) through our custom module ? If I follow the same hooks then how to call it at very last in Drupal 8?
Here: by drupalsettings, I am asking about the Drupal behaviors variable.
The question is updated as suggested by @leymannx.


texts: Using entity reference, need to get the nodes path in templates

texts: I have two content types. Projects and People. I installed entity reference which has allowed me to create a field in projects that consists of a drop down of all the nodes in People. Great! So then I printed out the value from the projects field in the projects node template, even better! What I would love to do is get the people node url path in the project template so people can click through from the project and get the profile for the person the project belongs to, is this possible (in the node template for project)?


texts:
I have been running a Drupal 8 site with Pixture Reloaded theme, based on Adaptive theme
(in my .info file, the corresponding lines are:

'base theme': at_core

'subtheme type': adaptive_subtheme)

and suddenly, without having done any changes in the site code (just entered content), I get errors of type:

  The website encountered an unexpected error. Please try again later.

  Twig_Error_Loader: Template
  "themes/adaptivetheme/at_core/templates/layout/html.html.twig" is not
  defined (Drupal\Core\Template\Loader\ThemeRegistryLoader: Unable to
  find template
  "themes/adaptivetheme/at_core/templates/layout/html.html.twig" in the
  Drupal theme registry.). in Twig_Loader_Chain->getCacheKey() (line 115
  of vendor/twig/twig/lib/Twig/Loader/Chain.php).

Also, I get similar error when trying to login in the admin, so I cannot clear any cache (if this could help). The site was working the same day earlier and the only thing I have done is enter new content (after having created a new view).

I would appreciate any help.


texts:
Is it possible in Drupal?

I'm developing a website in multilingual. It contains region (country name E.g USA, German, french....) and language (English, French, Japan....) selection.

When user select the region it brings in URL.

Eg: http://www.example.com/us[region-name]/en[language-name]

For single region, we can select many language

Eg: http://www.example.com/us[region-name]/jp[language-name] or http://www.example.com/us[region-name]/fr[language-name]


texts: Custom module - find out the name of the field

texts:
I have written a custom field module and I would like to know how I can programmatically find out what the name of the field in the database.

E.g. someone installs my module, that installs a new fieldtype and widget. The user adds a new field to a content type and calls the field "test_field". How can the module provide the database name of the field ("test_field") to some function within the module?

Currently I am hard-coding the name of the field which works fine until a user decides to use another name. Then I am not able to do some database operations anymore.


texts: Need a list of terms from a vocabulary machine name

texts:
How can I get the terms of a vocabulary using vocabulary machine name.

I have used the following code, although it works for me but I am looking for efficient methods.

$vocabulary = taxonomy_vocabulary_machine_name_load('school_courses');
$terms = taxonomy_get_tree($vocabulary->vid);
$courses = array();
foreach($terms as $term) {
    $courses[$term->tid] = $term->name;
}


texts: How to disable and enable all contributed modules in Mysql?

texts: I am trying to perform core update to site that was installed from backup of another Drupal 6.16 website with content and modules. Guides suggest to disable all contributed modules during update and enable them after. (Can this be skipped?) I know that modules can be disabled by changing their "status" in system table. I was thinking that contributed modules has different path value so they might be filtered somehow. Is it a good idea to export status column of the system table, set their status to 0, and import after?


texts: Tabs are all over the place. Is this normal?

texts:
Tabs in drupal are all over the place for my site. Is this normal? Clicking through the tabs on the same node constantly alternates between overlay (pop up) layer and the non-overlay layer, as below.

I can't help but think about how difficult and annoying this will be for the content authors, and am not looking forward to the questions they are going to ask me about the constant switching of the windows and layers.

Is there a way to standardise this behaviour, as opposed it being all over the place?

http://img402.imageshack.us/img402/8640/tabsiz.png


texts: How do I show the members in a block, contextually filtered by the currently logged in user?

texts:
In my project every group member will only ever belong to a group; some group members have the Group Administrator role.

I would like to create a view block to satisfy this story: As a user with the Group Administrator role I need to see a list of all members in my group so that I can easily access their information from any page.
Putting it in another way: I need to show a block on every page that lists all members of the group that the currently logged in user is an administrator of.

The permission stuff is simple enough. What I'm struggling with is the contextual filter on the view, and I'm thinking now that I'll need to do some code customization. I can't just add "UID of currently logged in user".  Am I missing the right configuration?

I just found this approach of making a custom block. I'll start going down that path but still very curious if I'm missing something.

Based on that link from Drupal.org, I'm currently doing the following:

/**
 * {@inheritdoc}
 */
public function access(AccountInterface $account, $return_as_object = FALSE) {
  return $this->groupMembership[0]->hasPermission('view group_membership content') &&
  count($this->groupMembership[0]->getGroup()->getMembers()) > 1;
}

/**
 * {@inheritdoc}
 */
public function build() {
  $build = [];

  //$build['group_member_block']['#markup'] = 'Implement GroupMemberBlock.';
  $build['group_member_block']['item_list'] = [
    '#theme' => 'item_list',
    '#list_type' => 'ul',
    '#wrapper_attributes' => [
      'class' => [
        'group-member-list'
      ]
    ],
    '#items' => $this->getGroupMembersItemList(),
  ];

  return $build;
}

protected function getGroupMembersItemList() {
  $group_members = $this->groupMembership[0]->getGroup()->getMembers();
  $items = [];
  foreach ($group_members as $member) {
    $user = $member->getUser();
    $items[] = [
      '#markup' => $this->getGroupMemberName($user),
    ];
  }

  return $items;
}

It is a pretty darn simple way to do it. For some reason, I expected to be able to hop right into views and build it though.  Again, maybe I'm missing something simple.


texts: Is there a better way to make a user profile tab using a view?

texts:
I have created a question node type using CCK and would like to show all of the questions which users create on a tab on their profile page.

The way I have done this feels a little indirect. I have:

Created a view which lists all of a user's questions and made a block to display it.
Configured the block so that it only displays on the right path ("user/*/questions").
Created an entry in hook_menu for this path. Used a page callback which calls a function which creates an empty page (see below).

Is there a more direct way to do this by, e.g., attaching the view directly to the profile page?

The code in hook_menu() is:

$items['user/%/questions'] = array(
  'title'            => 'Your Questions',
  'description'      => 'User Questions',
  'page callback' => 'answers_blank_page',
  'access arguments'  => array('create question content'),
  'type'     => MENU_LOCAL_TASK,
  'weight' => 9,
);

The page callback is simply:

function answers_blank_page () {
  return '';
}


texts: Taxonomy autocomplete is empty because of access control for anonymous users

texts:
I am using Finder, a great module for autocomplete searches. I am using it for autocompleting results from a taxonomy vocabulary. The way Finder works is it uses views for the autocomplete results. My view is a simple HTML list of all the terms from the vocabulary.

The taxonomy vocabulary is restricted only to logged in users. This causes the autocomplete to return empty results. I changed access settings in the view, but that didn't help.

Can anyone suggest a way around this?

I could simply redirect from the vocabulary path, but I'm not sure it's a good solution, since the data really needs to be private. How safe is it to just redirect?


texts: How do I render an entity view mode like 'teaser' in a twig template?

texts:
I have an entity reference field in one content referencing an other content.

What I'm trying to achieve is to display that reference in a teaser format programmatically.

I was hoping that I could do something like this :

{{ node.field_entity_ref.view('teaser') }}

But that doesn't work. Do I need to declare a preprocess anyway ? If so what's the best practice ?


texts: When I edit a display within a view, it changes other displays too

texts:
I have a question about the way displays in views work:

I have a view that has 8 different displays. Each display shows content of the same content type, but with different taxonomy terms associated with each (so one display would be something like Research Topic 1, another would be Research Topic 2, and so on).

The issue is that with two of the displays, when I edit one, the other automatically takes the same changes. All other ones work fine, except two. What I'm editing is the type of research (which as I said I'm using taxonomy terms to decide what is what). When I select one research type on display X, it changes the research type in display Y to be the same.

I'm not the one who originally set up this view, so I'm not really sure what was differently, if anything, to the others to make them work fine. Any help is appreciated!

Edit: One additional thing I just noticed is that "FILTER CRITERIA" for the two displays that seem to be connected is not italicized, but that heading in Views for all of the other displays within this block are italicized. No idea what this means, but just adding this info in case it's helpful.


texts: How to implement template file that would reside in database?

texts:
I was wondering if it would be possible to have a template "file" that would be stored only in DB and would not exist physically?

Twig tempaltes are parsed from files only once and they are processed and stored in DB anyway so would it be possible to have such DB entry from the get-go?


texts:
I am looking for a way (in D8) to create a colorbox gallery for a node field with multiple images but I am facing the following problems:

colorbox only works as an image field formatter (no media field formatter).
I would prefer media field since its nice to have entity browser to reuse some of the images.
Trying to create an image field that collects image using entity browser did not work for me. I was getting the error "The entity must be of type file" and none of the solutions seemed to work either. I even created a new entity browser but it did not succeed.
Media gallery and other related modules are not yet ported to Drupal 8

Is there any alternative?


texts: Building a simple dialog with 2 choices on button click

texts:
i am quite new with JS, Jquery UI experimentation.
I know the basics of Drupal 7 and i am working with some cool new functionalities on my personal website.
The latest one i would like to introduce is the possibility to click on my "CV" icon and show the user a super-simple jquery dialog with two buttons to either choose the IT or EN version.
To better understand what is that i want to implement, you can check a really simple graphic result at the link below.

example image

So what are my actual options? Should i code a custom block for this? or is there a chance i can build all this by inserting code inside the block body?
Can you point me a tutorial that shows some easy examples on how to implement basic structure like my case?

Thank you :)