texts:
I have created a views page which displays teasers.

Is there a way I can apply teaser node id as a class of the teaser's row. Currently I am getting these classes

  views-row views-row-8 views-row-even and views-row views-row-9 views-row-odd views-row-last


texts: Is there an Apache solr filter for path?

texts:
Is there a way to filter results by path with Apache Solr?

For instance, we would like have a filter that limits results to "/my-path-here".

It would only return results that have a path that begins with that.

/my-path-here/one
/my-path-here/nested/link
/my-other-path/should-not-show-in-results


texts: How can I create Folder like Structure with n Key Value Pairs?

texts:
I'm new to Drupal.

I'm trying to build the following structure

--Root
  --Cars
    --Luxury Car Campaigns (my "Folder")
      -Bentley CampaignInformation (1-n Key Value Pairs of different Types)
      -Lamgorgini CampaignInformation (1-n Key Value Pairs of different Types)
    --Japanese Car Campaigns (my "Folder")
      -Toyota Yaris CampaignInformation (1-n Key Value Pairs of different Types)
      -Corolla Verso CampaignInformation (1-n Key Value Pairs of different Types)

Note: A "Folder" is marked with a double-"--" and a key-value-list is marked with a single "-" (we call it internaly "Project"; but it is basically a named collection of key-value attributes/fields).

Every field can be of any type (Double, Data, Text and so on).

Every folder may contain unlimited subfolders or "Projects". (Must not be enforced by "Constraint")

Now the tricky Part (or not?):
Users can create Folders at any time. Users can create "Projects" in any Folder. Users can add any type of key-value pair to any Project.

Please give me a hint. Can this be done with Drupal? Do i have to dive into writing custom Modules?

I know a lot of Questions. Thanks in advance.


texts: How do I theme the output of the views-grid?

texts:
I have a few problems with theming/styling a grid made in Views.

I used the following:

Drupal 7.34
Views 7.x-3.8
Chaos tools 7.x-1.4
Zen subteme

The result I want to achieve is to make a grid with three collumns. The blocks consist of a title and an image retrieved from the nodes. The three tiles should be devided over the width of the content area. The height should be the same as the width. The image should be the background of the block and the title should be in the center of the block. When you hover over a block the image should change in a blue background color. Ideally the title should only be shown on hover. When a node does not have an image the block should have a blue background color with the title. On top of that I would like to create a checkersboard. So the even blocks should not show the image but a have a blue background color with a title.

I rewrited the output of the field in views

[field_image]

[title]

and added the following css in my stylesheet.

.frontblocks {
position: relative;
width: 230px;
display: block;
background-color: blue;
text-align: center;
text-decoration: none;
}
.frontblocks td {
background-color: blue;
}
.frontblocks img {
width: 230px;
height: 230px;
}
.frontblocks img:hover {
    opacity: 0;
    width: 230px;
    height: 230px;
}

In the result I've got so far there are six blocks. I managed to change the background color when hovering. But I have several problems I can't fix.

Problems:

the alignment of the title. For some reason when I use
text-align: center the title is shown underneath the image not on
top of it.
to create the checkersboard I tried to use :nth-child, but
unfortunatelly I didn't get it working.
when hovering the image the color changes, but when I hover the
title the image comes back as background.
when a node does not have an image the space is empty. Background is
white and the title is nowhere to be found.

Thanks in advance for helping me out!


texts: Determine which region a menu block is rendered in

texts:
I need to re-use the same menu in two different regions, with slightly different markup. My thought was to simply check which region the block was being rendered in, and use if statements to modify the classes/structure as needed.

I've hit a roadblock; I was able to find a way to get what region a block is in, but I can't figure out how to pass that data to the menu. Here's my current code:

// Add a region variable to a block.
function theme_preprocess_block(&$variables, $hook) {
    $block_id = $variables["elements"]["#id"];
    $block = \Drupal\block\Entity\Block::load($block_id);
    $variables["region"] = $block->getRegion();
}

I can output the region variable just fine in block--system-menu-block.html.twig, but trying the variable doesn't get passed to menu.html.twig, which is where I need it.

I feel like I'm a stones through form an answer for this, if someone could point me in the right direction I'd be greatly appreciative.

Quick side note: I'm very new to Drupal, coming from WordPress development. So far it's been a difficult transition, so please assume I know nothing about themeing :)


texts:
Possible Duplicate:
  Taxonomy in Contextual filters for Views

I want to browse the categories in my catalog. This is what my vocabulary looks like:

Products

prod1

subprod1

prod2

subprod2

subsubprod2

prod3

How can I make a view which displays the categories of a parent category? When you click Products you should see prod1, prod2 and prod3. When you click prod2 you should see subprod2. When you click subsubprod2 you should see the nodes in the category.

Anyone?

Thanks!


texts: sites/subDomain/libraries doesn't load the library files

texts: My website has two sub-domains, I need to install imageFlow library in both of these sub-domains but for some reasons I need to replace default images of imageFlow (I mean slider.png, button_play.png and button_pause.png) library in sub-domian1 with some images and in sub-dmoin2 some other pictures. To do so I created folders sub-domain1/libraries  and sub-domain2/libraries and I copied the modified version of the imageFlow in there. But unfortunately it doesn't work and imageFlow is not loaded. If copy the imageFlow library in sites/all it works well but in this way the same version will loaded for all sites.


texts: CSS fix for stacked gear icons in Drupal Panels?

texts:
When using the Panels module within Drupal, I often end up with multiple gear icons stacked on top of each other, inaccessible to the Drupal admin.

For example, take a Panels page with this structure:

MyCustomContentPaneTop
A Drupal View
MyCustomContentPaneBottom

When logged in as a Drupal admin, I can access the gear icon for MyCustomContentPaneBottom easily.

However, when I try to edit MyCustomContentPaneTop, I can only see an "Edit Panel" gear icon. I can see that this originates with this code, toward the bottom of the page.

  Configure

      Edit Panel

I can see in the HTML source that the gear icon does exist for MyCustomContentPaneTop, but it must be sitting in a z-index below the Panels gear icon.

Configure content pane

  ...

I know I can hack around with very specific CSS rules that apply only to pages where I discover this issue. However, is there an easy Drupal (or CSS) method to say, "If two gear icons are stacked on top of one another, stagger them by 5 pixels?"


texts: unable to link my custom content type nodes to a menu I created

texts:
I created a custom content type (pics). I can add this new "pics" content to my site (and if I want to, it can appear on front page, but I don't want to...) with no problem. But I would like those new added contents appear in my new menu (called Photos).

When I created my new content type I got a " machine name" : "pics". Then I created a new menu called "photos" and I put this name into the path field like this: http://www.example.com/drupal/pics

But it doesn't work this way. The menu will be empty with a Page not found message.

I'm new to drupal, so please bare with me.
Please let me know the solution.


texts: An illegal choice has been detected. after leaving form page

texts:
I have a form with only a select element and no submit button. Upon change, I issue an ajax call to retrieve the details of the selected Project. Everything works as expected, however after I leave the page, I see the error "An illegal choice has been detected. Please contact the site administrator."

I only get the error if I change the select input. Ex. if I navigate to:

  Home->Projects->Home

I don't see the error on the last Home page. If i navigate to:

  Home->Projects(change select input)->Home

I see the error on the last Home page.

Here is my module code:

class ExpeditionController extends ControllerBase {
  public $client;

  public function __construct() {
    $this->client = \Drupal::service('http_client');
  }

  public function listProjects() {
    $select_form = \Drupal::formBuilder()->getForm('Drupal\myModule\Form\ExpeditionSelectForm');
    // Remove the submit button.
    unset($select_form['actions']['submit']);

    $result = $this->client->get('myRESTService', ['Accept' => 'application/json']);
    $expeditions = json_decode($result->getBody());

    foreach ($expeditions as $value) {
      $select_form['expeditions']['#options'][$value->{'expedition'}->{'expeditionId'}] = $this->t($value->{'expedition'}->{'expeditionTitle'});
    }

    return array(
      '#theme' => 'myModule_expeditions',
      '#form' => $select_form,
    );
  }

  public function expeditionDetail($form, $form_state) {
    $expedition = [];
    $response = new AjaxResponse();
    if ($form['expeditions']['#value'] != "") {

      $client = \Drupal::service('http_client');
      $result = $client->get(
        'myService' . $form['expeditions']['#value'],
        ['Accept' => 'application/json']
      );
      $expedition = json_decode($result->getBody());
    }

    $response->addCommand(new HtmlCommand(
      '#expeditionDetail',
      array(
        '#theme' => 'myModule_expeditions_detail',
        '#expedition' => $expedition,
      )
    ));

    return $response;
  }

  public function deploymentDetail($project_id, $deployment_id) {
    $result = $this->client->get(
      'myService' . $project_id . '/' . $deployment_id,
      ['Accept' => 'application/json']
    );

    return array(
      '#theme' => 'myModule_deployment_detail',
      '#deployment' => json_decode($result->getBody()),
    );

  }
}

class ExpeditionSelectForm extends ConfigFormBase {
  /**
   * {@inheritdoc}
   */
  public function getFormId() {
    return 'myModule_expeditions';
  }

  /**
   * {@inheritdoc}
   */
  public function buildForm(array $form, FormStateInterface $form_state) {
    $form['expeditions'] = array(
      '#type' => 'select',
      '#title' => $this->t('Choose Project'),
      '#empty_option' => $this->t('Select a project'),
      '#default_value' => '',
      '#ajax' => [
        'callback' => 'Drupal\myModule\Controller\ExpeditionController::expeditionDetail',
      ],
    );

    return parent::buildForm($form, $form_state);
  }

  /**
   * Gets the configuration names that will be editable.
   *
   * @return array
   *   An array of configuration object names that are editable if called in
   *   conjunction with the trait's config() method.
   */
  protected function getEditableConfigNames() {
    // TODO: Implement getEditableConfigNames() method.
    return [];
  }
}


texts: Can forms be added to a page of quick tabs?

texts:
I want to create a page of quick tabs with some node editing pages, webforms and some admin pages as well regular static pages which just display information without any editing.

Is that possible?


texts: How to place the language switch in the main menu bar?

texts:
The language switch appears on the bottom of the page.
How can I move it to the main menu?


texts: How do I use the computed twig element to get the value from a custom composite element?

texts:
I have created a custom composite element by cloning the example module of Drupal 8 Webforms. It has a radio button and 4 select boxes. So when clicking 'Add" button, another row is being created, and likewise a series of 10 clicks would make the page too lengthy.
I need to list out a selected element ( Product ) in another table beneath the custom composite, and hide the filled row when the 'Add' button is clicked.
Since I am relatively new to Drupal 8, I have no idea how to achieve this. I tried using computed twig to fetch the data from products table using the syntax {{data.products.product}} where products is the key of the custom composite element & product is the select field inside the composite element. I didn't receive any output following the above syntax.
Could anyone help me out here ?


texts: How to send hidden field value to db on webform submit

texts:
I am using Drupal 7 webform api, have a created a field in my _form_alter hook in a custom module, but while on page load the hidden field contains the correct value, when I submit the form it does not save to the mysql table, and gives me an empty cell

$form['State'] = array(
  '#type' => 'hidden',
  '#value' => 'Unread',
  '#attributes' => array('id' => array('stateform')),
);

How can I make it save to the mysql table on submit?

UPDATE:

$form['State'] = array(
'#type' => 'hidden',
'#title' => t('Hidden'),
'#attributes' => array('id' => array('state')),
);
drupal_add_js(drupal_get_path('module','mymodule') . '/js/custom.js');


texts:
I'm using boost module 6.x-1.21 version and I noticed that one url is indexed with cache folder something like

  http://www.example.com/cache/normal/forum/623_.html.gz

will I block the this folder in ROBOT.txt file like this Disallow: /cache/

Is this correct way ? please suggest me, I'm not sure to do this.

Below is the code for boost module .htaccess file

 ### BOOST START ###

  # Gzip Cookie Test
  RewriteRule ^(.*)boost-gzip-cookie-test\.html cache/perm/boost-gzip-cookie-test\.html\.gz [L,T=text/html,E=no-gzip:1]

  # GZIP - Cached css & js files
  RewriteCond %{HTTP_COOKIE} !(boost-gzip)
  RewriteCond %{HTTP:Accept-encoding} !gzip
  RewriteRule .* - [S=2]
  RewriteCond %{DOCUMENT_ROOT}/cache/perm/%{HTTP_HOST}%{REQUEST_URI}_\.css\.gz -s
  RewriteRule .* cache/perm/%{HTTP_HOST}%{REQUEST_URI}_\.css\.gz [L,QSA,T=text/css,E=no-gzip:1]
  RewriteCond %{DOCUMENT_ROOT}/cache/perm/%{HTTP_HOST}%{REQUEST_URI}_\.js\.gz -s
  RewriteRule .* cache/perm/%{HTTP_HOST}%{REQUEST_URI}_\.js\.gz [L,QSA,T=text/javascript,E=no-gzip:1]

  # NORMAL - Cached css & js files
  RewriteCond %{DOCUMENT_ROOT}/cache/perm/%{HTTP_HOST}%{REQUEST_URI}_\.css -s
  RewriteRule .* cache/perm/%{HTTP_HOST}%{REQUEST_URI}_\.css [L,QSA,T=text/css]
  RewriteCond %{DOCUMENT_ROOT}/cache/perm/%{HTTP_HOST}%{REQUEST_URI}_\.js -s
  RewriteRule .* cache/perm/%{HTTP_HOST}%{REQUEST_URI}_\.js [L,QSA,T=text/javascript]

  # Caching for anonymous users
  # Skip boost IF not get request OR uri has wrong dir OR cookie is set OR request came from this server
  RewriteCond %{REQUEST_METHOD} !^(GET|HEAD)$ [OR]
  RewriteCond %{REQUEST_URI} (^/(admin|cache|misc|modules|sites|system|openid|themes|node/add|comment/reply))|(/(edit|user|user/(login|password|register))$) [OR]
  RewriteCond %{HTTP_COOKIE} DRUPAL_UID
  RewriteRule .* - [S=7]

  # GZIP
  RewriteCond %{HTTP_COOKIE} !(boost-gzip)
  RewriteCond %{HTTP:Accept-encoding} !gzip
  RewriteRule .* - [S=3]
  RewriteCond %{DOCUMENT_ROOT}/cache/normal/%{HTTP_HOST}%{REQUEST_URI}_%{QUERY_STRING}\.html\.gz -s
  RewriteRule .* cache/normal/%{HTTP_HOST}%{REQUEST_URI}_%{QUERY_STRING}\.html\.gz [L,T=text/html,E=no-gzip:1]
  RewriteCond %{DOCUMENT_ROOT}/cache/normal/%{HTTP_HOST}%{REQUEST_URI}_%{QUERY_STRING}\.xml\.gz -s
  RewriteRule .* cache/normal/%{HTTP_HOST}%{REQUEST_URI}_%{QUERY_STRING}\.xml\.gz [L,T=text/xml,E=no-gzip:1]
  RewriteCond %{DOCUMENT_ROOT}/cache/normal/%{HTTP_HOST}%{REQUEST_URI}_%{QUERY_STRING}\.json\.gz -s
  RewriteRule .* cache/normal/%{HTTP_HOST}%{REQUEST_URI}_%{QUERY_STRING}\.json\.gz [L,T=text/javascript,E=no-gzip:1]

  # NORMAL
  RewriteCond %{DOCUMENT_ROOT}/cache/normal/%{HTTP_HOST}%{REQUEST_URI}_%{QUERY_STRING}\.html -s
  RewriteRule .* cache/normal/%{HTTP_HOST}%{REQUEST_URI}_%{QUERY_STRING}\.html [L,T=text/html]
  RewriteCond %{DOCUMENT_ROOT}/cache/normal/%{HTTP_HOST}%{REQUEST_URI}_%{QUERY_STRING}\.xml -s
  RewriteRule .* cache/normal/%{HTTP_HOST}%{REQUEST_URI}_%{QUERY_STRING}\.xml [L,T=text/xml]
  RewriteCond %{DOCUMENT_ROOT}/cache/normal/%{HTTP_HOST}%{REQUEST_URI}_%{QUERY_STRING}\.json -s
  RewriteRule .* cache/normal/%{HTTP_HOST}%{REQUEST_URI}_%{QUERY_STRING}\.json [L,T=text/javascript]

  ### BOOST END ###


texts:
I would like to uninstall RSS completely from Drupal 8, not only hide it from pages, but also disable the core logic behind it.

How do I achieve it?


texts:
after long searching and many attempts I definitely need your help.

On the website I am currently working on, people can buy a "Participant" role for 1 year.
I'm using ubercart to handle the purchasing process.

I am trying to set up an automatic email which is sent when the Participant role is about to expire. Lets say 1 month before.

I know there is the Role module in UberCart, but I really don't like it and I also think it is not flexible enough. I also know about the User Expire module, but I am not sure I can do what I want to with it.

I was trying to create a Rule which:
- runs on every Cron run
- scan all the users Expiry Date field
- send an email to all the user with expiration closer than 1 month

Please give me some help...I am really out of ideas.

I hope I am missing a very easy way to implement it.

Thank you in advance,
guidout


texts: Commerce - Product and Total Price(s) on summary page not being updated by rule

texts:
I am creating an e-commerce website for a restaurant, there will be extra toppings available on pizzas. I have achieved this partially by using taxonomy to create the toppings and by giving this taxonomy term a field for price.

The rule then updates the price by adding the price of the topping on to the total price for that pizza. This is working when I view the cart page, but on the summary page it is not taking affect at all.

There is also an issue with the Ajax add to cart module in that if I add to cart a pizza of one kind with no extra toppings, and then add to cart the same pizza with an extra topping, the price in the cart for both pizzas is updated to be the price of the pizza WITH the additional topping.

However the total price is correct in this. I have checked the view for both the cart page and the summary page and they seem to be the same, which makes me think that the issue is with rules

This is my rule at present. I have used to commerce tutorial for a pizza shop using the customisable products module.

{ "rules_pizza_toppings" : {
    "LABEL" : "Pizza Toppings",
    "PLUGIN" : "reaction rule",
    "OWNER" : "rules",
    "REQUIRES" : [ "rules", "commerce_line_item", "commerce_product_reference" ],
    "ON" : { "commerce_product_calculate_sell_price" : [] },
    "IF" : [
      { "entity_has_field" : { "entity" : [ "commerce-line-item" ], "field" :     "field_extra_toppings" } }
    ],
    "DO" : [
      { "LOOP" : {
          "USING" : { "list" : [ "commerce-line-item:field-extra-toppings" ] },
          "ITEM" : { "pizza_topping" : "Pizza Topping" },
          "DO" : [
            { "commerce_line_item_unit_price_add" : {
                "commerce_line_item" : [ "commerce_line_item" ],
                "amount" : [ "pizza-topping:field-pizza-toppings-price:amount" ],
                "component_name" : "fee",
                "round_mode" : "1"
              }
            }
          ]
        }
      }
    ]
  }
}


texts: Redirect on node form submit with custom module - hook_form_alter

texts:
I have Druapl 6 with orgranic groups installed. I need a thing - when a group user creates "group" content after node form submission he must be redirected back on group homepage instead of node view page.

function heihachi_form_alter(&$form, $form_state, $form_id) {
  switch($form_id) {
        case 'group_wall_node_form':
        unset($form['buttons']['preview']);

        $redirect = 'node/' . $form['og_initial_groups']['#value'][0];
        $form_state['redirect'][0] = $redirect;
        //dpm($form);
        break;
  }
}

but that code doesn't redirect at all. Using simple $form['#redirect'] works, but it affects Node delete button aswell, so i can't delete my node because it redirects on a custom path. Thanks for all advices in advance.

My new code (not working also):

function heihachi_form_alter(&$form, $form_state, $form_id) {
  switch($form_id) {
        case 'group_wall_node_form':
        unset($form['buttons']['preview']);
        $form['#submit'][] = 'custom_redirect';
        //dpm($form);
        break;
  }
}

function custom_redirect($form, &$form_state) {

  //unset($_REQUEST['destination']);
  //unset($form['#redirect']);

  $form_state['rebuild'] = TRUE;

  $redirect = 'node/' . $form['og_initial_groups']['#value'][0];
  $form_state['redirect'] = $redirect;
}

This is what i see in $form variable:

0 (String, 21 characters ) menu_node_form_submit | (Callback) menu_node_form_submit();

1 (String, 31 characters ) auto_nodetitle_node_form_submit | (Callback) auto_nodetitle_node_form_submit();

2 (String, 15 characters ) custom_redirect | (Callback) custom_redirect();

I guess something wrong is there?

SOLVED!

used hook_nodeapi as one guy told me below:

function heihachi_nodeapi(&$node, $op, $teaser = NULL, $page = NULL) {
  if ($node->type == 'group_wall') {
    if ($op == 'insert') {
      $_REQUEST['destination'] = 'xxx';
    }
  }


texts: How to override limit of only 10 items showing in Create an Order page in Drupal Commerce?

texts:
On the Create an Order page (/admin/commerce/orders/add), my client is not able to see more than 10 items in the dropdown when using the 'Add Line Item' for a Product.  I can see that in the commerce_product.module that the function function commerce_product_autocomplete() is limiting with the following line:

// Get an array of matching products.
$products = commerce_product_match_products($field, $instance, $tag_last, $match, array(), 10);

..but how can this be overridden? Trying to implement a change in a custom module does not seem to be read by the system. Can anyone explain why this is, and how it can be changed?

Any help is greatly appreciated. Thanks!


texts:
Is there module that will enable user to create galleries and than embed them into article content, and display them in lightbox fashion?

For example, I can create a gallery in some UI, configure it (set gallery type, transition effects etc...) and than get gallery ID which I can use to embed it in article with some shortcode:

Some text...
[image_gallery ID1]
Rest of the text
[image_gallery ID2]
...
...

I have searched through drupal repositories and on google and didn't find anything like it. So I'd like to know if someone knows better or do I have to implement that functionality from scratch?


texts:
I have previously used <?php print $node->field_listing_artist[0]['taxonomy_term']->description; ?> on page.tpl.php. What this does is prints the description of the related taxonomy term of the node being displayed.

But I am looking to use this piece of code in a Block or a Custom Content Type in Panels.

From searching around, I can see (I think?) that i need to load_node, but cannot seem to get the code to work.
Similar Drupal Answers Question

So what i am trying to achieve is create a block/'Panels custom content type' that will correctly process <?php print $node->field_listing_artist[0]['taxonomy_term']->description; ?> of the node currently being viewed.


texts: How to programmatically add content to a group in the Group Module?

texts: I'm using the Group module. If I have a group type such as Project, and I have a content type such as Article, and I programmatically created a new article node using Node::create(), how can I in the same code add this article as content to a project that I choose?


texts: Node Access - Change ownership of node before loading

texts:
I'd like to change the ownership of a node before it loads on the edit page to essentially transfer ownership of a node from one person to another.  My goal is to give multiple users access to a single node.

I was looking through the Node API hooks and I was hoping that I could use either hook_load or hook_node_load and alter the $node->uid but both say this in the description:

  This hook should be used to add information that is not in the node or node revisions table, not to replace information that is in these tables (which could interfere with the entity cache).

So unfortunately I can't use those hooks.

I noticed that hook_node_prepare allows you to "act on a node about to be shown on the add/edit form", however, it looks like the node access hook already runs before that hook does, because I run into an "access denied" message.

My goal was to avoid having to control access to the node, and instead, just transfer ownership so that it can defer access control to the currently installed node access module (Taxonomy Access) and the "Edit Own Content" permission.  I didn't want to add more custom logic or additional node access modules on top of our existing access modules because it's already complex as it is and not recommended.

Is this the right approach or should I just cave and use hook_node_access (or some other access hook)?  I'm worried about the implications of adding another layer of node access to our already complex system, but if it's the best way to do it, I will.


texts:
I've a form...

function modulename_myform($form, &$form_state)
{
        $form['my_ta'] = array(
            '#type' => 'textarea',
            '#resizable' => FALSE,
        );
        $form['my_submit'] = array(
            '#type' => 'submit',
            '#input' => TRUE,
            '#value' => 'Submit',
            '#name' => 'sub_1',
            '#button_type' => 'submit',
        );
        return $form;
}

My form couldn't submit any data... So I tried doing two variants...

/* Form Submit */
function modulename_myform_submit($form, &$form_state)
{
    drupal_set_message('Submitted Value @name',array('@name'=>$form_state['values']['my_ta']));
}

Output : Doesn't print anything and says value is null at that location...

/* Form Submit */
function modulename_myform_submit($form, &$form_state)
{
    drupal_set_message(t('Submitting values: @values', array('@values' => var_export($form_state['values']['my_ta'], TRUE))));
}

Output : Prints the Dump with proper values...

Why is that? It should be giving me the text entered in my_ta right? Please help me...


texts: How do you populate an image field in a field collection programmatically?

texts:
I'm trying to do a large import that's more complex than feeds can play nicely with, so I'm in the process of writing a custom import script. Everything works except loading images that are associated through a field collection. I have a field collection that contains node and taxonomy references just fine, but I've had no luck on the image field.

I have a field on the node called field_signature_media which references a field collection that can be a variety of media types. In the field collection I have field_signature_image for handling the images.

Attempt One: using entity_metadata_wrapper:

    // Image file created in earlier part of the process and loaded into $file
    // The node that's being worked on has been created in $node
    // Create the field collection
    $fc_item = entity_create('field_collection_item', array('field_name' => 'field_signature_media'));
    $fc_item->setHostEntity('node', $node);
    $fc_wrapper = entity_metadata_wrapper('field_collection_item', $fc_item);

    $field = array('alt' => '',
          'title' => '',
          'fid' => $file->fid,
          'display' => 1,
          'width' => $file->image_dimensions['width'],
          'height' => $file->image_dimensions['height'],
          'image_field_caption' => array
              (
                  'value' => '',
                  'format' => 'full_html',
              ),
    );

    $fc_wrapper->field_signature_image->set($field);
    $fc_wrapper->save(true);  // <-- at this point it enters infinite recursion.
    field_attach_update('node', $node);

Attempt Two without the wrapper:

    $fc_item = entity_create('field_collection_item', array('field_name' => 'field_signature_media'));
    $fc_item->field_signature_image[LANGUAGE_NONE][] =
                        array('alt' => '',
                              'title' => '',
                              'fid' => $file->fid,
                              'display' => 1,
                              'width' => $file->image_dimensions['width'],
                              'height' => $file->image_dimensions['height'],
                              'image_field_caption' => array
                                  (
                                      'value' => '',
                                      'format' => 'full_html',
                                  ),
                        );
    $fc_item->setHostEntity('node', $node);
    $fc_item->save(TRUE);
    field_attach_update('node', $node); // <-- At this point field_collection cannot find an array it was expecting.

Attempt Three with wrapper and not creating field data by hand:

    $fc_item = entity_create('field_collection_item', array('field_name' => 'field_signature_media'));
    $fc_item->setHostEntity('node', $node);
    $fc_wrapper = entity_metadata_wrapper('field_collection_item', $fc_item);
    $fc_wrapper->field_signature_image->set($file->fid);
    $fc_wrapper->save(true);  // <-- at this point it enters infinite recursion.
    field_attach_update('node', $node);


texts:
This is very similar to How do I hide nodes that shouldn't be directly accessed from users and search engines?

I would like to:

Not have certain nodes be directly accessible at the full URL (ie. at node/1234 or its alias), since they're being used in a view
Make sure they're not being indexed in search engines

My questions are:

Does marking a node as "unpublished" have any side effects? other than viewing the node (assuming you're an admin) and seeing the node as unpublished
Marking a node as published yields a 401 when its viewed (at its full URL) by anonymous users. Does the page still get crawled? Is there a way to redirect the 401 and not get hurt from a SEO perspective?

EDIT: Using Drupal 7.

Thanks!


texts: Display taxonomy terms differently by content type

texts:
Is there any way to display the taxonomy terms slightly differently depending on the content type they appear in? For instance, I have two content types that I'd like to have use the same vocabulary, but the terms represent slightly different things to end users.

Example: a node field asks an organization "how are you interested in connecting with a campus?" and answers include "lead an interactive workshop" and "participate on a panel". When a different content type asks a teacher "how are you interested in organizations connecting with you?" the answers include "have an organization lead a workshop" and "host a panel". Obviously those answers correspond 1:1, so I'd like to use the same vocabulary. But they need to present themselves slightly differently in each content type.


texts: What versions from the Symfony components are used from core?

texts: Which Symfony version does Drupal use for the Symfony components? Is it a goal to support the latest versions of the components or is this simply not possible?


texts: I have 3 view blocks on my page which show a list of blogs(nodes) with a pager. The issue is that whenever I click the 'next' or any link on the pager, all the blocks change, not just the one Im clicking on. Is there some option which unties the paging from the other blocks??


texts: How can I count a multivalue field's values in twig?

texts:
I want to count the number of values of unlimited field in twig tempalate I tried

{{ node.field_mytext.count }}  => faced with error

and  in another try

{{ content.field_mytext.count }} => nothing returned

(in this method I checked my field is not in disabled field is display manager).

My question is how can I count the number of items of a field in Twig?

I hope I face with the solutions expect these solutions :D

add it in preprocess_node
use Twig Tweak


texts: Debugging menu build up: Where can I find the build-up code?

texts:
I encounter problems with the menu build-up (performed during cache rebuild).
In order to solve my own problems I would like to follow the build-up process using debug.

Where is the build-up done, exactly?


texts: Where are the "local files" for the Localization Update module stored?

texts:
I'm using the Localization Update module in Drupal 7.  As the "update source", I can choose "Local files and remote server".  I'd like to add some .po files that I created locally; where do I place them so that l10n_update can pick them up?

I don't see any options on the module's configuration page (/admin/config/regional/language/update).


texts: floating an image above a specific taxonomy termed node

texts:
I have to create a website that allows for a "new" tag to be floated above certain pictures that have the specific taxonomy term of "new".  I created a view for the "new" where I added an empty div below the image and then floated it above the image and added the actual "new" image with CSS.  This is what it looks like
For the "new" node.tpl.php the code looks like this:
<article class="node-<?php print $node->nid; ?>
<?php print $classes; ?> clearfix"<?php print $attributes; ?>>

<?php
// We hide the comments and links now so that we can render them later.
hide($content['comments']);
hide($content['links']);
print render($content);
?>

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

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

The id="new-intro" is the code that adds the background image to the empty div and places it above the product image.  So what I need is a code that automatically adds the id="new-intro" based on whether the product has the taxonomy term of "new"
I've found quite a few PHP samples but my knowledge is fairly limited and so I'm not sure that I'm editing them properly.
Can any one point me in the right direction??
Thanks so much!!
Edit:
So using the code below my code looks like this:
template.php:
function hayfield_preprocess_node(&$vars) {
  $node = $vars['node'];
  $vars['new_introduction'] = FALSE;
  if ($terms = field_get_items('node', $node, $field_new_introduction)) {
    foreach ($terms as $term) {
      if ($term['tid'] == 'new') {
        $vars['new_introduction'] = t('!published' == TRUE');
      }
    }
  }
}

and the node code looks like this:
<article class="node-<?php print $node->nid; ?> <?php print $classes; ?> clearfix"<?php print $attributes; ?>>

  <div <?php if ($new_introduction): ?> <?php print 'class="new-intro"' ?> <?php endif; ?>><?php
    // We hide the comments and links now so that we can render them later.
    hide($content['comments']);
    hide($content['links']);
    print render($content);
  ?>

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

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

But it's throwing major errors :
Warning: Unexpected character in input: ''' (ASCII=39) state=1 in /Users/Candace Morgan 2/Sites/hayfield/sites/all/themes/hayfield/template.php on line 33
(it doesn't like my argument in the last line of the template.php)
Fatal error: Cannot access empty property in /Users/Candace Morgan 2/Sites/hayfield/modules/field/field.module on line 936
the Content type is product_display, the field in the content type is field_new_introduction, the taxonomy vocabulary name is new and the taxonomy term name I want to reference is New Introduction.
I'm yanking my hair out on this one!!  Thank you for any help you can give me!!


texts: How can I get the current widgets name of a node?

texts:
I'd like to know if it is possible to get the current widgets of a node ?

field_info_widget_types() shows all the widget

But I'd like to get the widgets the current page is using and not all of them :(

Is there a way to to it ?

Thanks


texts: Direct db_query vs. Views query + views_query_alter - Drupal 7

texts: I have a search-based website. It contains several search criterions which can be a little complex or convoluted. I have migrated all original client's data into Drupal nodes and taxonomies. Now my doubt is if I can rely on Views 3 + Filters + Contextual filters alone, or should I construct direct calls to the database via db_query, or, the most versatile and still Drupal-oriented idea, use the Views 3 with contextual filters, but altering the sql code with views_query_alter (for example, for converting "=" to "LIKE" for a filter). What would you recommend?


texts: maintenance-page--offline template not working

texts:
I am following this tutorial. https://www.drupal.org/node/195435.
I have created maintenance page and its working with admin configuration site under maintenance setting. I want to create dboffline mode maintenance page. so for that, i have created another tpl "maintenance-page--offline" in same directory where "maintenance-page.tpl.php" has created. Path is like sites/all/theme/mytheme/templates/.

previously it was working but currently its showing me Additional uncaught exception thrown while handling exception. error. Its not overriding maintenance-page--offline when i am disconnecting DB, by entering wrong password in settings.php file.


texts: Webform alter with ajax submit callback - field values are empty in callback

texts:
At this point I'm doubting if I'm doing it the right way, but I'm struggling with an issue:
I'm adding an Ajax callback to the form alter of a specific form:
function mymodulename_form_alter(&$form, &$form_state, $form_id) {
if ($form_id == 'webform_submission_matching_node_218_add_form') {
    $form['actions']['submit']['#ajax'] = array(
        'callback' => 'matching_api_call',
        //'event' => 'click',
        'effect' => 'fade',
        'speed' => 500,
        'wrapper' => 'block-matchingblock',
        'progress' => [
            'type' => 'throbber',
            'message' => t('Matching...'),
        ]);
    }
}

The callback works fine but when I call $form_state->getValues(), I get an array with all my fields but they are simply empty or 0.
My callback function:
function matching_api_call(&$form, \Drupal\Core\Form\FormStateInterface $form_state) {
    // ajax debug
    $response = new AjaxResponse();
    $selector = '#block-matchingblock';
    $content = print_r($form_state->getValues(), true);
    $settings = [];

    $response->addCommand(new HtmlCommand($selector, $content, $settings));
    return $response;
}

My output:
Array(
    [field1] =>
    [field2] =>
    [field3] => 0
    [field4] => 0
    [submit] => Match
    [form_build_id] => {formbuildid}
    [form_token] => {formtoken}
    [form_id] => {form_id}
    [op] => Match
)

The entry is added in the backend so it does get submitted. Should I do something else because I'm using Ajax here?
Thanks in advance.


texts: After updating the metatag module I am unable to edit the metatag section of a taxonomy term

texts:
Today I have updated the Metatag module to the latest version (7.x-1.0).
However, I try to edit the metatags of a taxonomy term and, after saving the change, nothing changes (it doesn't save the changes).

I have been researching into the issue and I have read that this can happen when the metatag module is not up to date.

A new development version (7.x-1.x-dev) has been released today. I have tried downloading and using the development version (7.x-1.x-dev) and I still have the same problem. Is the problem related with database corruption? What do I need to do to solve the problem?


texts: How to add jQuery Datepicker option which accepts a function as an argument

texts:
I have added a date_popup field to a form :

$form['arrival_date'] = [
  '#type'                => 'date_popup',
  '#title'               => t('Arrival date'),
  '#date_format'         => 'd/m/Y',
  '#date_year_range'     => '0:+1',
  '#date_label_position' => 'none',
  '#default_value'       => '',
  '#size'                => '10',
];

I want to add an option to run a function using the onClose option so my js is :

(function ($) {

  Drupal.behaviors.ios2 = {
    attach: function (context, settings) {
      $('#edit-arrival-date-datepicker-popup-1').datepicker('option', {
        onClose: function (date) {
          // date will have the new date or empty string if no date
          // has been selected.
          alert(date);
          // Do something
        }
      });
    }
  };

})(jQuery);

However the onClose event never executes.  If I remove the 'option' argument thus :

$('#edit-arrival-date-datepicker-popup-1').datepicker({

it does work, but my suspicion is that it is replacing the datepicker with a new one, rather than altering the existing options.


texts: Views filter value based on a selected filter?

texts:
I'm trying build a garbage collection website where the user puts in their city, street, and street number and it tells them the day the garbage is picked up. Right now, I've imported about 14000+ addresses using feeds into a data table and have a view with 3 filters with autocomplete. The problem is that the filters are too simple: when you pick your city, the streets aren't narrowed down to just the applicable streets.

Is there a way for the streets filter to only show results based on the city selection? Am I going about this problem the wrong way?


texts: Can Apache Solr Search allow a user to search 'within' current results?

texts:
I'm looking for a way to allow a user to search 'within' current Solr search results (not search api solr results).

Is there existing functionality that provides this?

If I need to implement a module to do so, so be it; recommendations for what hooks to implement in that case would also be helpful.

Edit:

Re. amateurbarista's comment.  I'm wondering if there is a way to make a second query against the results of a first. I don't think Facets allow me to do this, is that so?

For example suppose my first search query returns 10 nodes.  I'm asking what it would take to allow a second query to search only within those 10 nodes.


texts:
So I created a custom menu through the Drupal administration and named it "More Menu." Its machine name, menu-more-menu, was auto-generated by Drupal.

Creating this menu automatically created its corresponding block, and its now available under Blocks administration as More Menu. I then enabled the block and placed it under my desired Region.

I wanted to theme the output of this block. I tried creating a template by following the template suggestion as described here, block--module--delta.tpl.php.

The template file I created was named block--menu--menu-more-menu.tpl.php.

It doesn't seem to work, and I still cannot override it.

Am I missing something?


texts: Creating Private file directories inside public files directory

texts:
I am developing a custom entity, which has a file field, which accepts .zip files. After the entity save, the contents of the zip file are decompressed into a folder specific to the .zip file, in the public files directory.

I'm am wondering if it is possible to create "private directories", which would act similar to standard Drupal private files...basically I want to restrict access to any file in the directory, but Drupal not knowing what files may be in the directory.

Basically the zip file will contain several .html files, javascript, and css files, which will be launched on the entity view page in an iframe.

Is this even possible?

Would anyone have some possible strategies to accomplish this goal?

I'm not asking how to setup a private file directory for storing and controlling access to single files, as is standard Drupal, I'm asking if it is possible to control access to any random file in a certain directory....inside the public files area.

I'm wanting to manage unmanaged files, by managing the parent directory, not the individual files

I'm open to using the Drupal core private file system, as long as Drupal doesn't have to manage the individual files specifically


texts:
Is there a way to only display a view result for Not Logged user.

If yes, How I could perform this.

I'm using drupal 7

Thanks a lot


texts: How to create a Workflow field instance in a node?

texts:
I want to add programatically an instance of a workflow field into the article content type.

This is how far I got:

<?php
// Create the field singleton
$field = array(
  'field_name' => 'field_workflow',
  'type' => 'workflow',
);
$field = field_create_field($field);

// Create the instance on the bundle.
$instance = array(
  'field_name' => $field['field_name'],
  'entity_type' => 'node',
  'bundle' => 'article',
  'label' => 'State',
  'description' => 'Workflow state information',
  'settings' => array( 'wid' => $workflow->wid ),
  'widget' => array( 'type' => 'workflow_default' ),
  'display' => array(
    'default' => array('label' => 'hidden' ),
  ),
);

Everything works fine except it doesn't assign the workflow to the field. The workflow has all the states and transitions defined. I can add it manually using the ui.

I added the setting 'wid' => $workflow->wid but it doesn't update it.

How can it be done?

Extract of the Bundle copy export for the workflow field created manually:

<?php

$data = array(
  'bundles' => array(
    ...
  ),
  'fields' => array(
    'field_workflow' => array(
      'settings' => array(
        'allowed_values_function' => 'workflowfield_allowed_values',
        'wid' => '17',
        'widget' => array(
          ...
        ),
        ...
      ),
      ...
    ),
  ),
  'instances' => array(
    'field_workflow' => array(
      0 => array(
        'label' => 'Workflow',
        'widget' => array(
          ...
        ),
        'settings' => array(
          'user_register_form' => FALSE,
        ),
        'display' => array(
          ...
        ),
        'field_name' => 'field_workflow',
        'entity_type' => 'node',
        ...
      ),
    ),
  ),
);


texts: Remove the link "add comment" if the user has already commented on the node

texts:
I wish that my users can leave only one comment per node (including by using the url).

Once their posted comment, I wish that the link "add comment" disappears.

I tried numerous solutions, such as Onecomment or custom code, but all prevent the second comment at the level of the form (form validate), with an error.

I would like for better user experience than it is not upstream possible to click on "add comment".

Do you know a solution ?


texts: Form API submit with AJAX removes wrapper element?

texts:
I'm using the Form api to submit with ajax which works once, but once it's happened the wrapper element has also been replaced by the new ajax content. How can I make sure the content get replaced, but the wrapper element stays there so it can be replaced again?

$form['submit'] = array(
  '#type' => 'submit',
  '#value' => 'submit',
  '#ajax' => array(
      'callback' => 'fung_filter_form_callback',
      'wrapper' => 'view-cont',
      'method' => 'replace',
)

For now I've got a workaround by returning the same wrapper in the ajax content, but this seems a bit strange - any ideas?


texts:
I would like to be able to input a range in my views conditional ,

e:g:

If (age > 0 && age <= 10)
{
 ...
}

How can I achieve this using Views_Conditional?


texts: Is there an Image field that let's users select a file from the server?

texts: I am currently using file field sources to allow users to select images on our server in the Content Type. However, these are rendering as a download link. Is there something that will let a user either upload or select locally and render as an image in both the full and teaser view?


texts: How to add 'read more' link in Blog comments

texts: I created blog entry pages for different subjects in a website. Each blog page displays its comments. I need to trim the comments and add read more link. I can trim the comments, but can't able to add read more link. I can't create view for the blog pages because different blog pages needs to display differently. Any ideas? Please help me.


texts: How can I make revision log message required based on revision checkbox by node_form_alter?

texts:
My goal is to make the "revision log message" required if "Create new revision" is checked on create/edit node.

I do able to add the visible and required mark based on the "create new revision" field.

function hook_form_node_form_alter(&$form, &$form_state, $form_id) {

  $form['revision_information']['log']['#states'] = [
    'required' => [
      ':input[name="revision"]' => ['checked' => TRUE],
    ],
    'visible'  => [
      ':input[name="revision"]' => ['checked' => TRUE],
    ],
  ];
}

I also able to make the "revision log message" as required.

function hook_form_node_form_alter(&$form, &$form_state, $form_id) {

  $form['revision_information']['log']['#required'] = [
    'required' => [
      ':input[name="revision"]' => ['checked' => TRUE],
    ],
  ];
}

But I don't know how to make the field required based on the "create new revision" checkbox.

PS: I want to make this simple and don't want to use the "Enforce revision log message" module.

// update 1: I found it require a custom hook validate and Im searching for it


texts:
I would like to know why there are no relationships been built between tables in Drupal Database.

I was just going through the Drupal database structure and wondering why haven't any relationship been created.

any explanation would be appreciated. one of the main thing that i was reminded was that, mysql database engines could be a limitation.


texts: Views proximity search by postal code show all when empty

texts:
I'm using proximity search in views 3.

The proximity search is by Postal Code.

When first loading the view page, it's showing all result.
In my case this is not good because the postal code is required for filtering.

My question is.

Is there a way to not showing all the result when postal code search field is empty.

Here is a screen shot of my views Criteria.

In More
Thanks a lot


texts: What is the Drupal's way of wrapping fields inside a field?

texts:
It seems that many Drupal gurus disfavor using Field Collection module to wrap fields inside a field. They say it's not the Drupal's way of doing it.

In my current scenario, I need a single field with before & after image subfields. I also need a recipe ingredients field, with ingredient name, unit size (using taxonomy reference) and serving amount subfields.

What is the preferred Drupal's way of doing such a thing? Should you have to code an entirely custom module for each field type?

Update

It seems that the ideal approach is to use a custom field type. Optionally you can use Drupal modules to group fields, such as Composed Field and Multifield, and not-so-favored, architecturally cumbersome, Field Collection. Another solution is to create a content-type for each group of fields and use Entity Reference to reference the field to it.

Ideally I'd like to see an example of a custom field type which implements a text and an image field, or something similar.


texts: What hook for installing a large list of field options?

texts:
If a custom module installs a dropdown-style field, using a large internal list of options (about 200 items), should this list be populated in hook_install or hook_init for greatest efficiency?
Yes, I know, with such an extensive list, I should provide an ajax-driven widget for ease of use, but at this stage of development and my skills this is a side issue :)


texts: File added programaticaly are not deleted when node is deleted

texts:
I'm creating a node programmatically with one image field. Nodes are Created without any problem.

But if I delete the node the file is marked as "used in 0 place" but never deleted (I run the cron).

If I edit the node and delete the file of the image field, the file is still marked as "used in 1 place".

I want the file be deleted instantaneously like if I create the node using the node form.

/**
 * Create a new book from google data
 *
 * @param array $booksData
 * @return \Drupal\Core\Entity\EntityInterface\static
 * @throws Exception
 */
function book_market_create_book_node(Google_Service_Books_Volumes $booksData) {

  // Google_Service_Books_Volumes object automatically iterate, this will get data from the first book
  $bookData = $booksData[0];

  if (empty($bookData['modelData']['volumeInfo']['title'])) {
    throw new Exception('book data are incomplete');
  }

  $bookNode = Node::create([
    'type' => 'book',
    'moderation_state' => 'published',
    'title' => $bookData['modelData']['volumeInfo']['title'],
    'body' => $bookData['modelData']['volumeInfo']['description']
  ]);

  $imageLink = $bookData['modelData']['volumeInfo']['imageLinks']['smallThumbnail'];

  if (isset($imageLink)) {
    $data = file_get_contents($imageLink);

    $transliterator = new Drupal\Core\Transliteration\PHPTransliteration(NULL, \Drupal::moduleHandler());
    $fileName = $bookData['modelData']['volumeInfo']['title'];
    $fileName = str_replace(' ', '_', $fileName);
    $fileName = $transliterator->transliterate($fileName, 'fr', '_') . '.jpeg';

    $field_cover_settings = $bookNode->field_cover->getDataDefinition()
      ->getSettings();
    $destination = $field_cover_settings['uri_scheme'] . '://' . $field_cover_settings['file_directory'] . '/' . $fileName;
    $destination = \Drupal::token()->replace($destination);

    $file = file_save_data($data, $destination, FILE_EXISTS_RENAME);

    $bookNode->set('field_cover', [
      'target_id' => $file->id(),
    ]);
  }

  $bookNode->enforceIsNew();
  $bookNode->save();

  return $bookNode;
}


texts:
How can I find out what entity type an entity is, when all I know is the entity ID?

Or is there a way I could list all the entity types on my website (or even via database)?


texts: How can I hide the Organic Groups Audience selection?

texts: I don't want the OG audience selection to appear on a custom content type I have created for groups.  I'm only providing the link to create the custom content within a group so the group they are in is pre-selected and it makes no sense to display it.  I can't believe there is not a OG option to turn this off so how can I accomplish this?


texts: Has anyone had old fullcalendar events vanish?

texts: Has anyone ever had old fullcalendar events in Drupal 7 appear to delete themselves? On our site we had a bunch of ones that had been updated in late 2014 and are no longer showing as there, either published or unpublished. I had been cleaning out older ones from 2012 & 2013, however, when I left work last week, the ones from 2014 on were still there. Today, they're gone. No one else was deleting events. Is there anything about recurring events that I could have messed up and caused others to be deleted?


texts: Using Feeds importer to import separate urls to same content-type

texts:
I'll try to parse out my problem laconicly:

I've two separate urls formatted as csv files that I want to import to the SAME content-type.

I'm using the same Feeds importer to accomplish this task, using the same unique identifier to import each url and update/overwrite all existing nodes.

Yet, for some reason I'm still getting new nodes when I should be getting updated nodes.

I have no clue where the process could be going wrong hence my post herein. Any help would be most emphatically appreciated.

David


texts: Delete the image from field if publication is older than XX days

texts:
I have Drupal 7, "Blog" content type, which has image field. Task: if the publication is older than 90 days, delete the image from field.

The idea was to use Views Bulk Operations for filtering (has a date between -90 / -91 days) and a Action set of Rules to remove images from the selected node field (run every day). At this stage, I could not understand how to change the value of the image field in action. Can anyone help?

Any other implementation ideas? Thanks!


texts:
I want to add a 'flag link' in an email. I have an event content type, and every time a new event created, the users get an HTML Email. I have a flag that the users can flag this event if they want to attend. I want to embed the flag link in the email, so that the users click the link and redirected to the flag confirmation page.

I've tried that with flag_create_link() in the email-template but it has two problems that makes it unusable in an email. First, I'm getting 'Bad token' error if click the link in the Email. Second, the URL generated is a relative URL, so I had to manually change the URL in browser to test, which got me to the first problem.

Is there any proper way to embed a flag link in an Email? So that, the user can click and directed to the confirmation page of the flagging, or login page if he's not already logged in.

UPDATE:

I've changed the link type to 'confirmation form' and that solved the first problem. I'm not getting 'Bad token' error anymore. However, the link path is still relative.


texts: Using Taxonomy Terms as slideshow pager (or at least group slideshow pages)

texts:
Something I can't seem to figure. How do I use Taxonomy terms as a pager in a slideshow. Essentially slides will be grouped by term. Filters are "destructive" so if I have three terms,  A, B & C clicking A only shows me A. I can't go from
A->B->C using the next arrow on the slides or vice versa (the needed functionality). If I use the field with the term I get a "page" for for each slide. I need just one for each group (same term) of slides. Any ideas on how to do this.


texts: Configuration page for module does not apear?

texts:
This is my hook_menu.

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

        $items['coverflow']  = array(
            'title'           => 'Coverflow Slider',
            'page callback'     => 'coverflow_page',
            'access arguments'=> array('access content'),
        );

        $items['admin/config/coverflow'] = array(
                'title'                 => 'Coverflow Settings',
                'description'         => 'Coverflow Slider Settings.',
                'type'                  => 'MENU_NORMAL_ITEM',
                'page callback'     => 'drupal_get_form',
                'page arguments'    => array('coverflow_admin_form'),
                'access arguments'=> array('administer site configuration'),
                'file'            => 'coverflow_admin_form.inc',
                'file path'       => drupal_get_path('module', 'coverflow'),
            );

        return $items;
   }

And this is my callback function for coverflow_admin_form

function coverflow_admin_form($form, &$form_state){

    $form           = array();

    $form['height'] = array(
      '#title' => t('Height'),
      '#type' => 'textfield',
      '#size' => 40,
      '#maxlength' => 120,
      '#required' => TRUE,
    );

    $form['width'] = array(
      '#title' => t('Width'),
      '#type' => 'textfield',
      '#size' => 40,
      '#maxlength' => 120,
      '#required' => TRUE,
    );

    $form['font-size'] = array(
      '#title' => t('Font Size'),
      '#type'   => 'textfield',
      '#size'   => 40,
      '#maxlength' => 120,
      '#required' => TRUE,
    );

    $form['font-family'] = array(
      '#title' => t('Font Family'),
      '#type'   => 'textfield',
      '#size'   => 40,
      '#maxlength' => 120,
      '#required' => TRUE,
    );

    $form['font-color'] = array(
      '#title' => t('Font Color'),
      '#type'   => 'textfield',
      '#size'   => 40,
      '#maxlength' => 120,
      '#required' => TRUE,
    );

    $form['submit'] = array(
        '#type' => 'submit',
        '#value' => t('Save settings'),
    );

        return system_settings_form($form);

}

After installing module im not getting configuration link at admin/config/coverflow.

What is wrong in this code?


texts:
How can i limit Hours in Date field ? like it begins in 12 untill 21:00 .
Any idea would be appreciate it ?


texts:
I'm working on ajaxifying a form which uses Hierarchical Select widget. I need to update a text field based on the value of HS and a couple of other fields. I want to use Drupal forms Ajax API. I followed the http://drupal.org/node/752056. Now the form is updated when user fills in the text fields. But I can't cope with HS.

I was told http://drupal.org/node/1630186 HS doesn't support regular Drupal #ajax mechanism. I can easily attach the handler to HS update event. So all I need now is to manually trigger Drupal Ajax machinery from my own handler. How it's best to be done?

I see there is a global Drupal.ajax object but can't figure out how to make use of it.


texts: Site Branding Block not appearing in regular page--html--twig template

texts:
I have a sub theme with the parent theme being the bootstrap theme.  I am able to configure the site branding block to show up on my content type pages and that's because my sub theme has a hook which suggests this full--width--page template.  This full--width--page template has the {{page.branding}} region in it and it works fine.

However it wont appear on the contact page or the user login page? I suspect the boostrap theme or parent drupal engine uses the regular page.html.twig template for contact page and user login page and other pages.  the {{page.branding}} does not seem to work in the page.thml.twig template.

I am looking for possible solutions.  Maybe I ened a hook to tell the theme to use the full--width--page.twig template but I don't know how to write that hook, or maybe I ened to find out what is wrong witht he page--html.twig template.

Any help would be appreciated.


texts: Nest a Field Widget's primary field in a Fieldset array

texts:
I'm porting over some logic that's working on a custom form to a new field widget; however, due to some javascript logic the custom form needs the end field to be nested within other elements, but when I try to nest the element in the widget, the value is not sent through the form.
Forcing a name attribute like I do below doesn't seem to help.

$element['filter']['client_selector'] = array(
    '#title'=>'Your Clients',
    '#type'=>'fieldset',
    '#theme'=>'mymodule_option_selector',
    '#list'=>$client_selector
);
$element['filter']['client_selector']['tid'] = array(
    '#type' => 'hidden',
    '#default_value' => $selected_client,
    '#attributes'=>array('class'=>array('hidden-value'),
        'name'=>$instance['field_name'] . '[' . $langcode . '][' . $delta . '][tid]'),
);

This works to send the value, but not with the selector system

$element['tid'] = array(
    '#type' => 'hidden',
    '#default_value' => $selected_client,
    '#attributes'=>array('class'=>array('hidden-value')),
);

Thanks!


texts: Redirect to an external site when accessing the page of a node meeting a set of condition

texts:
I need to redirect users to an external website when they access the node view page at node/%node of a node meeting some conditions.

What would the proper/best way to achieve this (using code) be?


texts: Managed file input is removing input values of appended input fields by ajax

texts:
I have a form with checkboxes that are calling ajax callback on checked. This ajax callback is appending another inputs:

$form['expertise']['op-cat-'.$op_cat['id']]['op-'.$op['id']]['checked'] = array(
    '#type' => 'checkbox',
    '#title' => $op['name'],
    '#default_value' => isset($usr['user_scope']['tid'][$op['id']]) ? 1 : 0,
    '#ajax' => array(
        'callback' => 'activit_full_profile_expertise_ajax',
        'wrapper' => 'expertise-div',
    )
);

Ajax callback:

function activit_full_profile_expertise_ajax($form, &$state) {

    $commands = array();
    $commands[] = ajax_command_html('#expertise-div', render($form['expertise']));
    $commands[] = array('command' => 'reinitializeTooltipster');
    return array('#type' => 'ajax', '#commands' => $commands);

}

In form is also an another managed file input:

$form['image'] = array(
    '#type' => 'managed_file',
    '#title' => t('Profilová fotografia <span>(nepovinné)</span>'),
    '#default_value' => isset($usr['picture']->fid) ? $usr['picture']->fid : 0,
    '#upload_validators' => array('file_validate_extensions' => array('gif png jpg jpeg')),
    '#upload_location' => 'public://user_images/'
);

Everything works fine if image field is not used after checkbox. If checkbox is used before image upload, it brings another input fields, but they are not present in $state['values'] in form validate & submit function (only original checkbox is present). They are not present in validate & submit function called by ajax of this image upload input, therefore they are not present in final validate & submit functions on form submit.

I have another custom ajax callbacks in form, but the appended input values are allways present. Is this a Drupal bug or am I missing something?


texts:
I have the following Notices and Warning on the Modules page:

  Notice: Undefined index: name in system_sort_modules_by_info_name()
  (line 951 of /var/www/vhosts/site
  name/httpdocs/modules/system/system.admin.inc). Warning: uasort()
  [function.uasort]: Array was modified by the user comparison function
  in system_modules() (line 802 of /var/www/vhosts/site
  name/httpdocs/modules/system/system.admin.inc). Notice: Undefined
  index: name in _system_modules_build_row() (line 988 of
  /var/www/vhosts/site name/httpdocs/modules/system/system.admin.inc).

I have searched on the internet for examples of this issue and found some, but the answers didn't help me, because it was about an error in a module i didn't have installed or the answer was too complex for me. Could anyone help me with above error?

I don't even know to which module it is related.


texts: Reset a page with multiple exposed filters

texts:
I have a view page which is the main page on my website. It is kind of a search using exposed filters. As I have many exposed filters I installed the module MEFIBS which allows me to split the exposed form into multiple blocks that you can place in different areas. I have enabled Ajax as I use the UI slider from Better Exposed Filters module. I am developing on localhost (D7).

Now, I want to include a reset button to this main page. BEF module provides "include a reset button" but in my case every exposed filter gets an own reset button which is not user friendly (this is due to the MEFIBS module).

I tried this approach by adding a simple html button and the script location.reload(true), expecting that the page reloads not from the browsers's cache rather than from the server. The reloading works but the filter settings don't get reseted and I don't know why.

Does anybody have expierience with that? Any advise what causes this problem? Or maybe another approach?

Thanks,
Thomas


texts:
I'm building a site with 2 menu's. One is the main menu, the other one is similar to the user menu.

The user menu is only displayed in a panel on the frontpage, the main menu is always visible. To keep the user-menu options available I'd like to add them to the main menu as well so they are always accessible too.

I thought of appending the user-menu to the main-menu in my custom template.php like below, but that gave me just the main-menu.

function THEME_preprocess_page(&$variables) {
  $variables['main_menu'] = array_merge(menu_main_menu(), menu_navigation_links('menu-myoptions'));
}

I was using the main-menu-block, so I thought that could be the reason the altered menu is not showing up. (The block might load the menu directly).
But when I user render($main_menu) in my page.tpl.php it doesn't work eighter.

Am I missing something?


texts: PDF version is different from Printer frendly version - using dompdf

texts:
Using the Print module, I managed to get dompdf working to some degree.
However, there are differences between the 'printer friendly version' and the 'PDF version' generated, specifically with regard to rotated text.
My concern is specifically about the rotated text, which rotation works for both printer version and PDF versions, but the PDF version has not positioned the text in the right place.
See below the differences:

When looking at the Printer friendly version's HTML, I see this:

I thought it might have to do with the float: I edited the dompdf_config.inc.php file:
def("DOMPDF_ENABLE_CSS_FLOAT", true);
However, that did make no difference in the output.


texts: I am still stuck with the same problem. CKeditor doenot work, instead the plain text editor gets open. I tried everything from re-installing ckeditor to updating drupal to newer version.when I open any heading and try to open the edit option, it runs very slow. then when it gets open the data is visible in the form of plain text(no ckeditor), i checked the console it shows this error Synchronous XMLHttpRequest on the main thread is deprecated because of its detrimental effects to the end user's experience in drupal Please can anybody help


texts: How to override a ctools plugin from another module

texts:
I want to modify some logic of a ctools plugin defined in the entityqueue module.

The file that contains the ctools plugin definition I want to modify is: /entityqueue/plugins/entityreference/behavior/entityqueue.inclink to file

This file makes use of the class EntityReferenceBehavior_EntityQueue which is defined here. I want to modify the logic in the presave function.

Is there a way to hook into it without patching the file?


texts: Sandbox module doesn't show any download link

texts:
I've recently developed a module, Drupal to SugarCRM Lea', and decided to contribute to community. I've followed every steps on drupal.org to do so. I have managed to upload all my code to the sandbox, but my project page is not showing any download links for my module.

Repository
Module page

What did I forget to do?


texts: I have created a menu for a specific role, how i can add a link, so the role could create content ?(I dont want this role to have administration menu, just a normal menu).


texts:
Following the documentation on https://www.drupal.org/docs/7/api/database-api/dynamic-queries/joins I have constructed a very simple dynamic query with join:

$query = db_select('node', 'n')
     ->condition('n.uid', $promoter, '=')
     ->condition('n.type', 'campaign', '=')
     ->condition('n.status', '1', '=')
     ->fields('n', array('nid'));
     $query->join('field_data_field_department', 'd', 'n.nid = d.entity_id');

  $result = $query->execute();
    foreach ($result as $record) {
      debug($record);
}

and it only returns nids whereas the expected results were nids together with the field_data_field_department field values. What should the correct query.


texts: How to export Panels Everywhere template code to a module

texts: I would like to export a Panels Everywhere site template to code. I know you get some configuration code when you select the export tab, but I'm not sure how you turn that into a module that will generate the template with it's variants and layout on another environment.


texts: Commerce 2 how to acces a users order items quantity

texts:
There is a similar question here but how can i access the amount of a product variation the current user has been ordered (in the last order)?
Would it be similar to this?
  $product_variation = $order_item->getPurchasedEntity();
  $product_id = $product_variation->product_id->getString();
  $product = \Drupal\commerce_product\Entity\Product::load($product_id);
  $product_amount = $product->getamountofOrders(); //or something like this


texts: Controlling remote Drupal sites with Drush

texts:
For a couple of weeks now I have been watching various screencasts and envying those who can operate Drush on their sites, esp. when enabling/disabling of the modules, or clearing cache. The time savings seem to be immense.

However, as a more of a front-end developer, rather than a qualified, fluent console operator, I find myself completely lost as per the usage of Drush with remote sites. Most of the googled readings treat about local sites, they specify paths to local installations, or they assume that a site was created using site-install command. While I am interested in adding Drush to an existing remote site. How do I add Drush into play with that remote site?

Now that I'm trying to get the big picture of using Drush, I think I may have missed some principal knowledge about the environment and tools needed, which I haven't found anywhere.

Apart from having command line Drush installed on my desktop, do I have to install Drush module on my remote site? Or is Drupal core Drush-controllable out-of-the-box (if it is, what is the purpose of Drush module available at drupal.org/project/drush)
Do I have to configure SSH for communicating the server?
Do I need to provide db credentials anywhere (where)?
Do I need to define FTP credentials anywhere (where)?
aliases.drushrc.php: does it live only on my desktop, or should I define anything similar on the remote ftp?

My setup involves staging and production sites, the former also stored on a remote ftp server with its own domain. I would like both to be controllable via Drush. Is that feasible?

It'd be great if someone could shed some light on me.


texts: Views contextual filters taxonomy name 2 fields using same vocabulary

texts:
I have a content where two fields using the same vocabulary.
I want to show nodes related content filtered by the these fields.

I try with relation

Relationships

content:field_1
(term from field_field_1) Taxonomy term: Content using field1 (Relationship term from field_field_1 ;  Require this relationship )

Contextual filters

   (field_field_1) Content: field_2

   Provide default value : Taxonomy term id from url
   Load default filter from node page
   Limit terms by vocabulary ( country)

   Specify validation criteria ( taxonomy term )

    Vocabularies : Country
    Filter value type : Term name converted to Term ID
    Transform dashes in URL to spaces in term name filter values

This query returns nothing.

I don't want to use Views PHP code fields because of security concerns.


texts: Altering the views Sorting Criteria, to display first ISSET fields

texts:
Ia am working on a view that displays search results for nodes of a certain content type. In this Content Type there is a field "photo". Some of the nodes have a photo, some of them not. Is it possible to display (in the search results), first the nodes that have that field filled and at the bottom the nodes where the field photo is not set?

I tried to achieve it with custom sorting in the PHP field, using a snippet that i found here : https://drupal.org/node/727418#comment-3827246

$query->orderby = "CASE WHEN myFieldName IS NULL THEN 0 END, myFieldName ASC"; }

but it didn't work. Any ideas?


texts: Make Openlayers center & bounds context aware

texts:
I'm creating geospatial database for multiple municipalities. Each should be able to work in it's own context (not only see only own data, but also have custom center & bounds for input and output maps).

I tried to find this functionality in OpenLayers module, but wasn't successful. I only found "zoom to layer" functionality, which isn't applicable, because there will be different layers for each municipality.

The most straightforward way I can think of is using geofield-defined bounds in user entity, which OpenLayers could use.

Do you know about any solutions?


texts: Accessing Drupal REST endpoint using Oauth 2 token

texts:
I have successfully installed the Simple OAuth module on my website. I am also able to authenticate to it using Postman. I am getting the access_token and the refresh_token when authenticating. However, am not able to figure out how I can use this token to access Drupal's default REST endpoints or the endpoints provided by JsonAPI module.

I tried sending the token in the header with Authorization as key and Bearer {{the token }} as the value with no success. What is the right way to use the token for communicating with Drupal?


texts: EntityRegistration: How do I show who is registered to other registrants/members

texts:
Actually I am relatively new to Drupal - so maybe for a Drupal-Crack this is chicken-food - but not yet for me :-)

I'm building a new Drupal 7 (7.14) site using "Views" and "Entity Registration" (Beta1) to build a event system where members can join events and leave some comments. Therefore I've set up the "Event" entity using Drupal fields and the Views module. Then I've created registrations for the events and added them to the "Events" as a field. No problem so far - works great and users can join events incl providing their additional registration information (Events are "Scuba Dives" and additional information is the Equipment Configuration, Gasmixes, Body-Team, etc).

As an event organizer (creator) I can see a tab with the list of registrants (divers) but I don't see this tab/information as a normal member/registrant.

This is where I got stuck: How can I show the list of participants to all members (role)? I like to show them on the same "page" as the eventdetails are. Maybe creating a block or so? Maybe create a view for a block (with fields, sorting and grouping) and show this as block on the events.

I already know that I can customize a nod by adding a theme-template for a specific content-type. Don't know if that would work to bring the list of participants to my events...

As you see I am not really sure what way I should go with this and what make most sense. Any help/hint would be great!

Cheers,
Marc


texts: How can I reconnect Image Style to display from media library

texts:
when I deleted an image style all my images inserted with the "insert from media library" editor-button disappeared.
how can I make them visible again?
In the source code I still can see :
<drupal-media data-align="center" data-caption=" " data-entity-type="media" data-entity-uuid="1c9c918c-1849-4835-abf5-110a618cb29c" data-view-mode="default"></drupal-media>

I suppose I have to re-connect the view mode with the image style somewhere- but where?
Or what can I do, to have the images displayed again?
Best regards,
Adriana


texts: Why implementation of node access for different content type breaks my other type access control?

texts:
System architecture:

Main entities:

Company
Employee (and other user types)
Document

References:

Every document has reference to company and employee.
Every employee has reference to company also (at least one company)

I've implemented custom access control for documents, which suppose to working fine (my unit tests gives me all green also).

Now I'm creating View - documents list for an employee. Basic version of View is working correct. I want to add exposed filter for a company. By default this is a list of all companies. But I want to restrict this list only for companies from employee documents, related to current logged in employee.

Code:

/**
 * Implements hook_node_access_records().
 */
function mymod_company_node_access_records($node) {
  if ($node->type <> myCompany::CONTENT_TYPE_NAME) {
    return array();
  }

  return array(
    array(
      'realm' => MYMOD_COMPANY_LOCK_NAME,
      'gid' => $node->nid,
      'grant_view' => 1,
      'grant_update' => 0,
      'grant_delete' => 0,
      'priority' => 0,
    )
  );
}

/**
 * Implements hook_node_grants().
 */
function mymoo_company_node_grants($account, $op) {
  if ($op <> 'view') {
    return array();
  }

  if (mymod_user_is_an_employee($account)) {

    $myUser = myUser::createFromUser($account);
    $companies = $sdUser->getCompanies();
    if (empty($companies)) {
      return array();
    }

    $grants = array();

    foreach(array_keys($companies) as $nid) {
      $grants[MYMOD_COMPANY_LOCK_NAME][] = $nid;
    }

    return $grants;

  } else {
    return array();
  }
}

Indeed filter list is restricted to employee related companies, but in my View, I'm seeing ALL documents related to these companies. Why?

My View main content type is Document. Company is related node via entity reference field. I don't understand why company access control has some type of precedence here.


texts: For multilingual sites, do I set up a separate taxonomy?

texts: If I decide to set up an additional language for my site, do I need to manually set up a translated version of my existing taxonomy, or is there a module that can manage that process for me (not the translating part, obviously)?


texts: "Add another item" slows down the performance and takes more time for loading the page again

texts:
We have an option for adding group of value fields in the content page but every time as we add more items and click "Add another item", the page becomes very slow and takes longer time to load.

I am new to Drupal 7 and getting the hang of it slowly.

How to improve the performance and is there any other simple way to implement "add another item?"

Where should I start with?
Any help would be appreciated.
Thanks


texts: how can I change digits from latin to persian digits

texts:
I am using Drupal with localization module,
 in persian language,
I want in persian show persian digits instead latina digits?


texts: changed theme -> Logged out -> No log in field shown :(

texts:
I cant find the log-in or registration fields on my wellcome page after i changed my theme and loged out myself.

How can i make the log in field visible again?

thank you for help.


texts: How can I make a Menu Block not auto-expand the current page's menu links?

texts: I want my menu block to decide whether to show link children based only on whether the menu link (or the entire menu block) is set to "Expanded", not whether you're currently on the same page as the link that has children. What's the best way to do this?


texts: Take all sites in a multisite environment offline at the same time

texts: Is there an easy way to take all sites in a multisite environment offline at the same time, in just one step?  I really don't want to log in to each one and do it one at a time when I do something that involves all of them.


texts:
I'm trying to create some blocks with custom content in Drupal 7, but I cannot see them anywhere (Structure>Blocks)

I'm using Drupal 7
I have successfully activated the module
Cache is not activated

Here is the code:

bcndevcon.info

; $Id: bcndevcon.info,v 1.0.0.0 2011/02/09 10:11:15 BcnDevCon Exp $
name = "Custom BcnDevCon Modules"
description = "Custom BcnDevCon Modules In Code"
core = "7.x"
package = "Custom BcnDevCon Modules"

bcndevcon.module

<?php

function bcndevcon_blocks_info() {
    $blocks['my_custom_block'] = array(
        'info' => t('Custom Block Name'),
    );

    $blocks['my_custom_block2'] = array(
        'info' => t('Custom Block Name 2'),
    );

    return $blocks;
}

/**
 * Implementation of hook_block_view().
 */
function bcndevcon_blocks_view($delta='') {
  $block = array();
  switch ($delta) {
    case 'my_custom_block':
      $block['subject'] = t('Custom Block Name');
      $block['content'] = bcndevcon_contents();
      break;
  }
  return $block;
}

/**
 * custom html block
 * @return string
 */
function bcndevcon_contents() {
  return '

      Hello World, this is a example custom Block

  ';
}

?>

Any suggestions?


texts: How to change the alias for the core forum landing page?

texts: Core forums sets the landings page to /forum. I need this changed to /another-page/forum. I know I can change the forum posts using pathauto, but I need to change the alias for the top-level forum landing page. Thoughts?


texts: Adding WYSIWYG to webform email template field

texts:
I want to enable the WYSIWYG editor so I can create HTML mail from webform email templates. (Yes, I know some people don't like HTML in emails.)
I have created a module, and I'm using this code:

function mymodulename_form_alter(&$element, &$form_state, $context) {
  if (isset($element['template']['template'])) {
    $element['template']['template']['#wysiwyg'] = true;
    $element['template']['template']['#type'] = 'text_format';
  }
}

This is great, and the WYSIWYG is enabled. Unfortunately it changes the values from a string to an array, and I can't figure out how to convert them back again. I was hoping this would help, but hook_field_attach_presave() doesn't seem to fire for that form. In fact, I can't find any hooks that fire for that form.

Any suggestions?


texts: How to add user matching taxonomy term value to hidden term reference field

texts:
I have mathcing taxonomy term for all users. For exmaple user Matt has taxonomy term Matt (this is made manually).

I have hidden term reference field in node. When Matt create a node then there should be chosen to hidden term reference field term value Matt - which match for user Matt.

Problem is: How to "link" user Matt to term Matt and then how to add this value automatically when user created node?


texts:
I am using Drupal 7.
I just started creating a new drupal site. Instead of downloading all of the necessary contributed modules, I copied them from a different test site I had made recently. There were a few modules which needed to be updated, so I put the site in maintenance mode, deleted those module folders, pasted in the new ones, ran the update script and now I have no errors. However, now it still says "Operating in Maintenance mode - Go Online", and clicking "Go Online" brings me back to the maintenance configuration page, but I remain in Maintenance Mode! I cleared all caches and nothing helped!
I could just restart everything from scratch, but I would like to understand this issue.

I'm not sure if this make a difference, but originally when I installed the drupal database, I used a previously created database which had only one table (non-drupal) which I deleted before installing the drupal database tables. Should this have effected anything?


texts: How to retrieve the order id of an order in drupal commerce?

texts:
Is there a way to do it from the tpl?

ie: page--admin--commerce--orders.tpl.php

I've tried this, but naturally, I get an undefined $order_id variable

if (commerce_order_load($order_id)) {
  echo $order->uid;
}


texts: How to change Read more option in the front page of drupal 7?

texts:
I am using drupal7. If we published a content to "promoted to front page". It will act as from the default front page view. I want to change the "Read More" option as "More". Where i can change the option? Please help me?

Thanks,
Sathish


texts: How to a use a template file to theme a form?

texts: While nodes, comments, blocks and many other things in Drupal are themed using theme template files (like node.tpl.php), forms are a different story. There are no theme template files for forms. How can I get a particular form to use a custom theme template?


texts: display individual comments votes (fivestar) using views

texts: I want to recreate drupal node using views. Under node title there would be average voting result + comments with individual voting. I try to display individual comments votes on a node using view. It always returns 0 no matter what configuration I try. I spent whole day trying to solve it. Can anybody help me with this? Thank you very much.


texts: Redirect according to views filter input

texts:
I have a view with two filters (country and city) on node (country) page. What I want is redirect to another node page according to user input (filter country). So if user viewing page node/uk and chooses USA in country filter and New York in city filter, drupal must redirect to page node/usa showing results for New York. View is using AJAX.
Tried using drupal_goto in views exposed form submit but this produces error Drupal.Views.Ajax.handleErrors is not a function in ajax_view.js. Help me please.


texts: How to access custom customer shipping profile fields during shipping calculation

texts:
I'm attempting to create a shipping calculation based on fields I've added to the shipping customer profile however I've been unable to access them through either the rules interface nor by creating a custom rules condition.
I have a single page checkout and when an element of the shipping address is updated, an ajax request is fired and the shipping calculation rules are run.
I'm currently creating a custom rules condition which takes in an order however I can't seem to get the submitted customer shipping profile from the order.
When I fetch the customer profiles from the current order, it just gets those from previously submitted orders. Here is my rule condition:
function mymodule_rules_condition_info() {
  $conditions = array();

  $conditions['mymodule_compare_custom_field'] = array(
    'label' => t('Compare Shipping Custom Field'),
    'parameter' => array(
      'commerce_order' => array(
        'type' => 'commerce_order',
        'label' => t('Order'),
        'description' => t('The order containing the profile reference with the address in question.'),
      ),
      'operator' => array(
        'type' => 'text',
        'label' => t('Operator'),
        'description' => t('The comparison operator.'),
        'optional' => TRUE,
        'default value' => 'equals',
        'options list' => 'mymodule_address_comparison_operator_options_list',
        'restriction' => 'input',
      ),
      'value' => array(
        'type' => 'text',
        'label' => t('Value'),
        'description' => t('The value to compare against the Shipping Custom Field.'),
      ),
    ),
    'group' => t('Commerce Order'),
    'callbacks' => array(
      'execute' => 'mymodule_rules_compare_address',
    ),
  );

  return $conditions;
}

function my_module_rules_compare_address($order, $operator, $value) {

  // If we actually received a valid order...
  if (!empty($order)) {
    $wrapper = entity_metadata_wrapper('commerce_order', $order);

    $query = new EntityFieldQuery();
    $query->entityCondition('entity_type', 'commerce_customer_profile')
      ->propertyCondition('uid', $wrapper->uid);

    $results = $query->execute();

    if (!empty($results['commerce_customer_profile'])) {
      $profiles = commerce_customer_profile_load_multiple(array_keys($results['commerce_customer_profile']));

      foreach ($profiles as $profile) {
        dpm($profile);
      }
    }
  }
  return FALSE;
}

function mymodule_address_comparison_operator_options_list() {
  return array(
    'equals' => t('equals'),
    'begins with' => t('begins with'),
    'contains' => t('contains'),
    'is one of' => t('is one of'),
    'begins with one of' => t('begins with one of'),
  );
}

I've tried passing in the order by passing both commerce-line-item:order and site:current-cart-order but I've been unable to get the required data from either.
{ "rules_add_15_for_custom_field" : {
    "LABEL" : "Add $15 shipping for custom field",
    "PLUGIN" : "reaction rule",
    "OWNER" : "rules",
    "REQUIRES" : [ "rules", "mymodule", "commerce_line_item", "commerce_shipping" ],
    "ON" : { "commerce_shipping_calculate_rate" : [] },
    "IF" : [
      { "mymodule_compare_custom_field" : { "commerce_order" : [ "site:current-cart-order" ], "value" : "Test" } }
    ],
    "DO" : [
      { "commerce_line_item_unit_price_add" : {
          "commerce_line_item" : [ "commerce_line_item" ],
          "amount" : "1500",
          "component_name" : "shipping",
          "round_mode" : "1"
        }
      }
    ]
  }
}


texts: When can uid 1 get an access denied page?

texts:
I am having a very strange problem that I can't track down.

We have been working on a custom site for a client now for several months.  Theme is a Zen subtheme.

I can't remember the last time I tried to access it, but I am getting an "access denied" when I try to view /admin/build/themes/settings/mysubtheme, even as uid 1.  It is getting logged this way, too, so I think it really is an access denied.  I can access this page for Zen, Rootcandy, and other enabled themes.

I have done all of the usual tricks for attempting to fix this (run cron, clear cache, rebuild node perms, assign all perms to my superuser role, etc) without luck.

A theme-settings.php exists for the theme and all of the hooks are named properly for the theme.

How is this possible since user_access returns TRUE when uid==1?

Thanks.


texts:
I have a form element in d8 as follows :

$form['cluster_dropdown'] = array(
    '#type' => 'select',
    '#title' => 'Cluster',
    '#options' => $cluster_options,
    '#default_value' => $cluster_selection,
    '#ahah' => array(
      'path' => 'module_name/admin5/callback',
      'wrapper' => 'dependent-dropdown-wrapper',
      // 'event' => 'change', // default value: does not need to be set explicitly.
    ),
    '#attributes' => array('class' => 'cluster-dropdown'),
  );

But in this case ahah callback is not working , is there gasf/admin5/callback want to replace with routing path as am using this in d6? any idea ?


texts: Users are unable to approve a one way relationship

texts:
I've set up a one way relationship with the User Relationships module When one user requests a relationship to another user, the table that should allow the other user to approve/deny the request has no operations automatically populated.

To be more specific lets say this is a Manager relationship to an employee. Where User A is the manager and User B is the employee. User A requests to be User B's Manager. User B receives the request and follows the link to the page where he/she would normally approve the relationship.(example.com/user/[uid]/relationships/received) When User B arrives on the page there is a table showing the request, but under the Operations column there is nothing in the cells.

I initially thought this was a permissions issue, but when I looked it appears that both users have the permissions they should need to accomplish this.

For reference I'm using version 7.x-1.0-alpha5 of the User Relationships module.


texts: In drupal 7 I want to crop same image for different device ratios. How can I do this?

texts:
In drupal 7 I want to crop same image for different  device ratios. How can I do this.

On uploading image and We have to crop for different ratios.


texts: Displaying a product price on Ad Push content?

texts:
Hi just started using Drupal a couple of days ago.
I'm using Commerce Kickstart 2. I'm having troubles displaying the product price on the Ad Push content. I just want to know if there is a way to display the product price on the Ad Push?

Thank you very much.


texts: Features are sweet but what about content?

texts: I used features successfully to restore my VIEW and content type...but the data for the content type didn't make it? Did I miss the option or is this something you typically bring over manually?


texts: How to extend flood control in a custom module?

texts:
I would like to use Drupal's flood control capability in another module. I have a resource I'm protecting with a password.

Can I simply call flood_register_event() and otherwise use the variables as used in the code for user_login_final_validate()?

Am I on the right track at all, or how do I use flood control?


texts: Not able to overwrite old value in Drupal.settings

texts:
I am facing Problems in overwriting old value in Drupal.setting.

Problem Statement

I am passing FID value from PHP to JS. At first it is getting correct value in JS.

Ex. When PHP is passing FID=59 to JS for first time then it is correctly received by JS.
Next time when it is passing FID=60 then it is showing FID=59 in JS always.
Drupal.setting is not refreshing with current value.

My sample php code is like this

 function TraverseSnap($nextFID)
 {
    $thm_slideshowimg .= '<input type="image" src="nxt.jpg" class="clsNextSnap" width="25" height="25">';

    $nxtSnapSetting = array(
            'fid' => $nextFID,
     );

    drupal_add_js(array('nxtSnp' => $nxtSnapSetting), 'setting');
 }

JS Code

(function($) {
 Drupal.behaviors.VidsImgsContent=
 {
      attach: function (context, settings)
      {
          var fileId = Drupal.settings.nxtSnp.fid;
          var dataNextSnap = 'fid=' +fileId;
          $.ajax({
                  url: 'nextsnap',
                  type: 'POST',
                  async : false,
                  dataType : 'json',
                  data : dataNextSnap,
                  success : updateMainNextDiv,
                  error : function(jqXHR, textStatus, errorThrown){alert("Some Error occured");},
                  beforeSend: function()
                  {
                  },
               });
               return false;
       }
  }
  })(jQuery);

My hook_menu call

$items['nextsnap']=array(
   'title'=>t(''),
   'type'=> MENU_CALLBACK,
   'page callback' => 'nxt_snap_post',
   'access arguments' => array('access content'),
);

Page Callback

function nxt_snap_post()
{
    $fid=$_POST['fid'];

    $htmlResult = TraverseSnaps(60); //An arbitary Value for sake of this example
    drupal_json_output($htmlResult);
    exit();
}

So I believe when the button is clicked next time it will take FID=60 in JS but it is taking old value instead.

Please help here as my crucial logic depends on this.


texts: Why is my JSON looking like this and what can I do about it?

texts:
On Drupal 8, I enabled the serialization and restful web services and I created a restful view in order to create a map. The format is WKT. However, the output looks like the below.

Can/should I do something about it? Can this be parsed as is?


texts: Use taxonomy_get_tree() to extract term names?

texts:
I'm using the handy taxonomy_get_tree() function to, hopefully, just extract the list of term names within a vocabulary. Sounds simple enough, but I'm stumped. Running the following:

$tree = taxonomy_get_tree(2);
print_r($tree);

yields the following:

      Array
(
    [0] => stdClass Object
        (
            [tid] => 1
            [vid] => 2
            [name] => The First Term
            [description] =>
            [weight] => 0
            [guid] =>
            [depth] => 0
            [parents] => Array
                (
                    [0] => 0
                )

        )

    [1] => stdClass Object
        (
            [tid] => 2
            [vid] => 2
            [name] => The Second Term
            [description] =>
            [weight] => 1
            [guid] =>
            [depth] => 0
            [parents] => Array
                (
                    [0] => 0
                )

        )

)

Now all I want to do is pull out each of the name values. So I tried the following:

foreach($tree as $value){
    print($value['name']);
}

I'm returning a server error. I suspect it has something to do with that pesky stdClass Object thing.

So any ideas how I can extract just the names?


texts:
How can I get the url generated by the pager in views.

drupal/project11?page=1
drupal/project11?page=2

I would like to add a link on my image to the 2nd page on my first image, to the 3th page on my 2nd image without using the pager.