Mixing field collection items with regular fields in views

I think this is not the right views set-up for what you want to display, you have done wrong field selections. To see direct solution scroll down to Solution section.

What is the Issue:

If you see your views field setting it is like as follows,

Content: title
field collection item: Bubble title
field collection item: Bubble image
Content: Body
Content: Link

So, here in above view set-up the field collection item is just one field, so through views you are just accessing one field, hence, the concept of field collection module dies here. Here, it is just a field which you are accessing through the Relationship.

Now, why you are observing what you are observing in the view,

Your Node: Following is the correct representation of your Node, Not what you have shown in your Question. Your node has FIVE main fields- and whatever inside the field collection field are field-in-field.

   1. title
   2. field collection
     2.1a field collection 1 image
     2.1b field collection 1 text
     2.2a field collection 2 image
     2.2b field collection 2 text
     2.3a field collection 3 image
     2.3b field collection 3 text
   3. body
   4. text
   5. link

Now, you have set your views like as follows,

   1. Content: title
   2.xx field collection item: Bubble title
   2.xx field collection item: Bubble image
   3. Content: Body
   4. Content: Link

I think by this time you would have understood why you are getting what you are getting in views.

Let me explain:

Cycle:1 Views start the first cycle and iterates from its Fiest field to Fourth field, so it will showing following fields:

   1. Content: title
   2.1a field collection item: Bubble title
   2.1b field collection item: Bubble image
   3. Content: Body
   4. Content: Link

Cycle:2 Now, views works stops there, But wait, Views discover that another 2.xx and 2.xx are there on node, So it starts second cycle so again from TOP to Bottom,

   1. Content: title
   2.2a field collection item: Bubble title
   2.2b field collection item: Bubble image
   3. Content: Body
   4. Content: Link

Cycle:3 Then  again third cycle, So that why you are getting this,

   1. Content: title
   2.3a field collection item: Bubble title
   2.3b field collection item: Bubble image
   3. Content: Body
   4. Content: Link

So whatever views are showing it showing correct as per your field selection, But that is not what you want, please see the solution in following section, it is very simple.

Solution:

The solution is very simple: You just need a field which represent the entire field collection of that node and luckily that is present in views.

Remove the relationship: You do not need the relations ship.
Modify the field: Instead of selecting individual field, select entire field collection which you can find as Content:nameOfFieldCollection. in my case it is FC101.

Example:

I have created Content type with:

1. Title
2. Body
3. Field collection(FC101)
   - Image
   - text
   - Image
   - text
   - Image
   - text
4. Body2

My views set-up:

Output in VIEW:

1. Title
2. Body
3. Field collection(FC101)
   - Image
   - text
   - Image
   - text
   - Image
   - text
4. Body2


$form['File'] = array(
        '#type' => 'managed_file',
        '#title' => t('Choose  File'),
        '#upload_location' => 'public://MyFilesFolder/',
        '#default_value' => $entity->get('File')->value,
        '#description' => t('upload file'),
        '#states' => array(
          'visible' => array(
            ':input[name="File_type"]' => array('value' => t('Upload Your File')),
          ),
        ),
      );


in drupal 7, how can drupal link to another remote service, consume the data in the web service such as nodejs?

You can always use the API from Node.js project. And build a module using it to consume your node.js server.


Delete "permanent" file when it has 0 uses

Prior to 8.4.x this was the default behavior, but a number of issues with file reference counting meant it was possible for files to get deleted prematurely (and possibly also for stale files to linger, though that's not so important). In 8.4.x the default behavior was changed. See Files that have no remaining usages are no longer deleted by default.
For completion, to answer the question it's possible to change back to the old behaviour by setting make_unused_managed_files_temporary to true in file.settings. It's clearly not recommended (that's why core doesn't use it anymore). See Dealing with unexpected file deletion due to incorrect file usage to track progress on file reference tracking.


If you are looking for generalized payment options Ubercart CCavenue can help. On their official website they provide some economy plans as well, which is good for setting up basic payment modules in place.


In Drupal 7, a theme function like yours receives an array containing the variables declared in hook_theme(). If you execute element_children($form) with the form you defined, you get an array containing the following values:

checkboxes
quantinty
price
remove
submit
checkout

The control statement if (isset($form['checkboxes'][$key])) { will not be executed, if not in the case you have $form['checkboxes']['checkboxes'], etc.

Your theme function should use the following code.

function theme_cart_page_form($variables) {
  $form = $variables['form'];
  $rows = array();

  foreach(element_children($form['checkboxes']) as $key) {
    $row = array();
    $row[] = array('data' => drupal_render($form['checkboxes'][$key]));
    $row[] = array('data' =>drupal_render($form['quantinty'][$key]));
    $row[] = array('data' =>drupal_render($form['price'][$key]));
    $rows[] = $row;
  }

  $header = array(
    'Checkboxes',
    'Title',
    'Quantity',
  );

  $output = theme('table', array('header' => $header, 'rows' => $rows));
  $output .= drupal_render_children($form); // Render rest of form components.

  return $output;
}

Actually, you should declare the theme function using the following code.

function yalublurudn_theme() {
  return array(
    'cart_page_form' => array('render element' => 'form'),
  );
}


Deny node access depending on field value

With what user do you check the access, as stated in the docs

  The administrative account (user ID #1) always passes any access
  check, so this hook is not called in that case. Users with the "bypass
  node access" permission may always view and edit content through the
  administrative interface.

user 1 will always have access ..

Make sure to check with an anonymous or regular user.


display description and price field from a term reference

If you have token you could 'rewrite output' on the Configure field: screen. I think yours is called 'form' (your 2nd last pic).

On that edit screen scroll down a little and you will see the rewrite output header. In there you can add tokens for fields that are already called earlier in your display. You can call the value and 'exclude from display' just to load them and have them available.

Unfortunately I can't make out the machine names you have assigned to the terms, but there is a button to show you all the available tokens.

Sooo, you could write the output and have
 <label ...>[..field:?topping_ref:name][..field:?topping_ref:name]</label>


You can simply copy database all right, if you remember about critical points:

Make sure settings.php really points to proper databases
Before importing SQL file to new database, find and replace old URL and site name with new one.
If you keep any cache settings for external tools, like memcached, in database, make sure you either uninstall them before SQL export and then install again, or find & replace in SQL file before importing.


When a user login fails, is it possible to say "Password incorrect" or "Username does not exist" instead of the default message?

This message is set in user.module in the user_login_final_validate() function.  It's set as a bog-standard form_set_error() so can't really be over-ridden.  Looking at it, it also doesn't differentiate between whether or not the username or password is incorrect, so you wouldn't really be able to do anything useful.

As Clive mentioned, it's much better practice to keep a degree of ambiguity in certain error messages, and seeing as how this isn't wrapped in any kind of theme function and doesn't have separate behaviours for whether the username exists or password was incorrect, you're probably better off leaving it as is.

One last option you have is to user a hook_form_alter() on user_form to set an extra validation callback, and then check for the user name yourself.

Example:

(I can't remember the $form_state for the user form, so you'll have to die() or dpm() that yourself)

function mymodule_check_username_exists($form, &$form_state){
  $user_exists = user_load_by_name($form_state['name']);

  if ($user_exists == FALSE ) {
   form_set_error('name', t('This username does not exist'));
  }
}


Through Rules module you can achieve this:

First step create a custom rule at /admin/config/workflow/rules/reaction/add
Select the React on event: "Completing the checkout process"
Add a new Action: "Send mail"
Once you add the email addresses from/to, than add the replacement fields in the body text of the email. I suggest: [commerce-order:order-number], [commerce-order:type], [commerce-order:commerce-line-items]. But you can figure that part out.

Save your Rule.

Get a Beer and celebrate you are now forwarding new orders to your customer fulfillment department.


Set trim_length of field through UI for blog entries

You can go to admin/structure/types/manage/blog/display/teaser and on the right next to the format settings for Summary or trimmed you will see a button with a little star on it. Click on it and set your trim length.


Problem is - you are trying to generate styled image, but you do not provide security token. In Drupal 7.20 and later security token is required so images are only generated when Drupal site itself tries to use them. To turn it off, just add the following line to your settings.php file:

$conf['image_allow_insecure_derivatives'] = TRUE;

Solution taken from this answer and 7.20 release notes.


how to get individual classes for each menu list items

It looks like you need Menu attributes module:

  You should use this module when

  You want to "nofollow" certain menu items to sculpt the flow of PageRank through your site
  You want to give a menu item an ID so you can easily select it using jQuery
  You want to add additional classes or styles to a menu item

Alternatively, if you don't mind some coding, see theme_menu_link(). Comments in it's documentation already shows how to do it:

   function superseven_menu_link(array $variables) {
     $variables['element']['#attributes']['class'][] = 'menu-' . $variables['element']['#original_link']['mlid'];

     return theme_menu_link($variables);
   }


Custom search box to be included in a view

If you are trying to filter views result, then adding Custom Search block will not work.
To get this work you need to add Global: Combine fields filter under Add filter criteria, then select fields on which you want to filter the result from Choose fields to combine for filtering. Expose this field to display a search text field. Please check screenshot below:


How to target and remove a given fieldset

There's a wee bit of confusion in your PHP code there; you're calling a function with the same name as the string passed in $form_id, and passing 'edit-body-und-0-format' as a parameter.

What you need to do is change the relevant field in the $form array, e.g.

function THEMENAME_form_alter(&$form, $form_state, $form_id)  {
  $form['edit-body-und-0-format']['#access'] = FALSE;
}

Using #access is preferred to unset(); there might be something in a validation/submit handler that's relying on the existence of those fields, whether or not values have been submitted this time round, and removing it completely might break those (or cause some unpleasant warnings).

If you haven't already installed it, the Devel module is a must for development; you can use the dpm() function to inspect PHP elements on the front end. If you add dpm($form); to your current function, for example, when you visit the page you'll see a nice structured output of the $form variable making it easy to find the element(s) you want to alter.

Update...

If you're trying to hide the text format options there's a slightly different approach. You need to attach an after build function to the textarea, and remove the format options in there. For example:

function THEMENAME_form_alter(&$form, $form_state, $form_id)  {
  if ($form_id == 'some_form') {
    $form['body']['#after_build'][] = 'MYTHEME_body_after_build';
  }
}

function MYTHEME_body_after_build($element) {
  $element[LANGUAGE_NONE][0]['format']['#access'] = FALSE;
  return $element;
}

or something very similar.


I believe you did not configure the Calais module correctly.

Go to admin/settings/calais/calais-node, expand the fieldset of your content type and pick either "Apply all suggested terms on every update" or "Apply all suggested terms on creation ONLY" from "Calais Processing:" field.
This way, the tags will be applied automatically.


Is there a way to search Drupal's and contrib modules configuration settings?

Useful fact: drush vget abc lists all variables with 'abc' in their name. So if you are looking for settings related to css, drush vget css might provide you with a clue. Likewise you can use the name of a module in your search to see all the settings from that module.

Some modules have complex settings that are stored in separate database tables. In that case I recommend using a tool such as SQLyog that has a search facility which will scan an entire database, or just specific tables, for a given input string.


You may use field "Content: Has new content" in views to display "updated" text


Go to Home > Administration > Configuration > Content authoring > Text formats. Click Configure next to text format you are using for blog posts, probably Filtered HTML. On the Enabled filters list, check Gist. On the Filter processing order, drag it to the end, or at least to be after Convert URLs into links and Limit allowed HTML tags filters.


Bulk action on views only works for the administrator role?

If using Action Permissions, under Admin > People > Permissions, double check the "Execute action name" permission is enabled for the role(s).

It may also be that the user role needs permission to eval that php code in the Rule as well as possibly a userpoints grant points permission required.

Lastly, check the Rules module user permissions and also in edit form for the actions on the rule itself.


Where are the best places to post Drupal 7 RFP?

drupal.org reaches a wide audience, and is a good venue.  That said, please be aware that widely distributing an RFP can be harmful to your project.  Many of the best shops don't respond to RFPs.  Advomatic has published an interesting presentation on this topic.


How to integrate a custom one page php app into drupal 7?

A custom module with a menu callback is the way to go. In general, themes and tpl.php files should only control what your site looks like. Modules should control what your site does.

I understand that you don't want to refactor your code completely and turn everything into render arrays. Fortunately, you don't have to. You can create a string of html and put it in a render array like this:

// Generate your html.
$html = '
Hello world!
';
// Wrap it in a render array.
$output = array (
  '#markup' => $html,
);

Now, this is the really simple version. I do recommend that you take advantage of some of Drupal's features.

First of all, if you didn't already do so, I would create separate menu callbacks for the ajax requests. If both the rendering of the page and the ajax requests are handled by the same menu router, you might get in trouble when Drupal starts caching things.

Second, I would take add all javascript (and possible css) to the page using the #attached property of your render array. This also allows Drupal to cache (parts of) your page without breaking things. Assuming that your module is called "mymodule" and your javascript is stored in mymodule.js, your render array could look like this:

$output = array (
  '#markup' => '
Hello world!
',
  '#attached' => array(
    'js'      => array(
      drupal_get_path('module', 'mymodule') . '/mymodule.js',
    ),
    // If your output requires certain CSS rules, regardless of the theme
    // that is used, add a CSS file like this.
    //'css'      => array(
    //  drupal_get_path('module', 'mymodule') . '/mymodule.css',
    //),
  ),
);


I think the quick answer is "you can't sort on a rewritten value" in Views; regardless if it's a date field or using Search API.
There are however; various workarounds depending on the particular issue. I have used the following now:

use Computed Field to store the rewritten value in the db and then display/sort on that
SearchAPI is capable of doing simple rewrites with its Aggregated Field; this may work for simple rewrites.

You can often combine a computed field and a rewrite in Views to take advantage of Views field formatting. Keep in mind that the sorting occurs on the original db value for the field. So, for my example above, you could do a computed field to store the timestamp of the Date Range's end date; and then add that to the View but rewrite that field with the formatted end date. This will then sort on the timestamp; but display the properly formatted value.


How know inside hook_entity_presave() if it's a create or update?

Like this:

if ($node->isNew()) {

}

Note that this only works before saving, in insert/update, it will always return TRUE, because the node has already been saved and is no longer new.


User relationship requests in a view block with accept and decline links

Add requestee relation.
Add context filter by user id (set it on current user with requestee relation). Add filter criteria by relationship status.

Here you can see screenshot of view.


Access Drupal7 Database Nodes without actually having anything installed (simple php + mysql)

If I'm not wrong you want a 'query' that connect a content type with all its fields.

Each field has it own table.

But you can connect the dots using a few queries ([content_type_name] could be article, car_entry or whatever the name of your content type is):

*Getting all the entries for a content type

  SELECT * FROM node WHERE type = '[content_type_name]'

  column id would be the [entity_id]

*Getting all fields from a content type

  SELECT * FROM field_config_instance WHERE entity_type = 'node' AND bundle = '[content_type_name]'

  this table contains column field_id [field_id] and column field_name [field_name]

Now that you have the fields:

*Get the field info using field_id and/or field_name

  SELECT * FROM field_config WHERE id=[field_id] AND field_name='[field_name]'

*Get the field data by node

  SELECT * FROM field_data_[field_name] WHERE entity_id = [entity_id]

Play around with those queries, so you get a better idea of the columns that each one of those tables contains. Then you can create mysql joins to create the queries that you need.


Views, getting nodes type 1 which user have NO node of type 2 published that references the node type 1

This has already been answered here.

A simple view will not do what you want.


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

It sounds like you already have the solution for selecting the image, you just need to control the output of how it is displayed. Are you using the file field instead of the image field? The file field will output by default as a link to the file, rather than as an IMG tag which is what you want.

If you want to keep the field the same but output it as an image, you have two options: you can use an integrated wysiwyg editor or file browser (IMCE is probably the closest to what you're looking for) to assist the user in displaying the file as an image.

Or - you can theme your node template to take the url of the file field resource and output it as an image. This is a little more involved but you can start here with template suggestions and ask more questions if you get stuck.


formBuilder()->getForm() outputs everything except the  tag in a view?

Looks like views reformats rendering as a form if there are any form elements in a row. See \Drupal\views\Plugin\views\display\DisplayPluginBase::elementPreRender:
    // If form fields were found in the view, reformat the view output as a form.
    if ($view->hasFormElements()) {
      .....
    }

I guess you should see one <form> tag arround the entire view.
In this case a possible solution would be to create a custom views display plugin Forms, that overrides the elementPreRender method and ignores the form elements check.


Your main menu can be 1 level deeps links to content. You just maintain these links as your top level content links as needed in the Menu configuration page.

For each main-menu item, make a new Menu where you actually set the link from your node edit pages.

Use MenuBlock and like the Context module (or just default the Block UI, eww) set each sidebar menublock to appear for the appropriate main-menu url path.

-- OR TRY --

You can try to make main-menu your site tree of all links, then use 1 menu-block set to 2-level deep starting point based on the url path.

I usually try to do the 2nd option .... then find its inflexible at some point and need a collection of menus and menu_blocks as I first described which from experience works better. Especially for cross-linked content (you may get the wrong menu block in the 2nd approach, for cross linked content as it shows the first menublock that menu_block finds the link within).


nid is a property of the comment entity, so try:

$query = new EntityFieldQuery();
$query->entityCondition('entity_type', 'comment')
    ->propertyCondition('nid', 257)
    ->addMetaData('account', user_load(1));


Found it: Forgot the 'input ...' in my custom theme function :).

function theme_mymodule_thumb_upload($variables) {
  $element = $variables['element'];

  if (isset($element['#file']->uri)) {
      $output = '

';
      $output .= 'uri) . '" />';
      $output .= '<input type="submit" id="edit-' . $element['#name'] . '-remove-button" name="' . $element['#name'] . '_remove_button" value="Remove" class="form-submit ajax-processed">';
      $output .= '<input type="hidden" name="' . $element['#name'] . '[fid]" value="' . $element['#file']->fid . '">';

      return $output;
  }
}


Add Menu Block (module) Menu To Page tpl

It seems like you're mixing the Drupal 6 and Drupal 7 api a little bit.

If you're on Drupal 7, you should print out your block like this:

<?php
$block = module_invoke('module_name', 'block_view', 'block_delta');
print render($block['content']);
?>

Note the 'print render'. (You're missing the 'render' part if you're on Drupal 7.

The only things you need to change are to put 'menu_block' for the 'module_name' and your block's machine name for 'block_delta'.

More info and examples are on drupal.org: http://drupal.org/node/26502

Does that work for you?

============ Edit ==============

On the other hand, if you're on Drupal 6, your call should look something like this:

<?php
$block = module_invoke('module_name', 'block', 'view', 'block_delta');
print $block['content'];
?>

In this case, you're fine with the just 'print $block['content']', but your arguments are a little off.  From what you're saying though, it sounds like you're on Drupal 7, and are just returning the array without rendering it!!! :-)


you need to use a callback in your submission .. something like this:

        YOURMODULE_form_alter(&$form, &$form_state, $form_id) {
    if($form_id == 'YourFormID') {
          $form['#submit'][] = 'custom_submit_function';
        }
}

        function custom_submit_function($form, &$form_state) {
          drupal_set_message('ALERT MSG HERE');
        }

this drupal_set_message() would give you the normal drupal message

if you don't know how to know your form ID ,, just print $form_id inside hook_form_alter() you'll see it there so you can make your if condition depending on it.


Commerce- How can I add a custom field to Account Information on checkout

I think you are looking for Commerce User Profile Pane module.

  Commerce User Profile Pane is a module that allows you to capture a
  Drupal Users profile fields directly in the Commerce checkout pages.
  This is similar to the Commerce Billing Profile or Commerce Shipping
  Profile panes, but instead of storing extra fields in the Commerce
  Profile entity, this will allow you to store it directly in the Drupal
  core User entity. This is useful when you want a quick registration
  process without the user having to fill a long user registration form,
  but you still want to retain the option to complete the User profile
  info in the checkout phase.


How can I add a skip button above the webform (with multistep)

It seems that basically, you want a copy of "next", but with different title and placed on top. To achieve it:

Examine structure of form you are alerting. Find where original "next" is defined.
Create a copy of it. Use code like:

$form['my_skip_button'] = $form['path']['to']['next']['button'];

You Don't really need to know or care what it is, you need a copy, so you go and make a copy, simple as that.
Set weight to something low to get it to top:

$form['my_skip_button']['#weight'] = -10;

You can alter the title in the same way you altered weight.


How to show thumbnail images on product pages using ubercart module?

Firstly go to [your-domain]/admin/config/media/image-styles and create image style you want to use for your product images, than go to [your-domain]/admin/structure/types and click on 'manage display' on the right (for content type that you are using for products).

You will find your image field whose format is probably 'Image' and you will see a little gear on the right, click on it and for 'Image style' choose image style that you created previously (as mentioned above).

That's it. Now the images will be shown according to image style that you created.

For the list of the product I recommend that you use Views module and again to control your display image size by choosing image style for image field in Views.


Where are the webform files in the D8 directory?

We can install the modules in (root/modules/contrib) as webform is contributed module.

But by default, all contrib modules are in (root/core/modules/webform.)


Why isn't my feature overridden after I change a rule in it?

Rules UI shows the rule as "overridden". If I click "revert" on that page, the rule reverts to the state saved in my_feature.rules_defaults.inc.


As the comment noted this question would benefit from much more detail.

There are 2 very broad scenarios here;

Loading LDAP user attributes for use and reference within Drupal (probably user entities) users that exist.
Linking LDAP users to Drupal in an ongoing fashion including some form of authentication requirement.

In the first case you won't likely be dealing with LDAP user credentials (which is good) and greatly simplifies the implementation.  This is a good example; on Drupal.org using LDAP feeds.

In the second case LDAP feeds is probably not the best or only module you'll need.  This d.o article covers some ground but there are important gaps, but also some good linked resources in that section that could be of great help to you depending on your needs.

There are a plethora of variants on these cases.  One time vs ongoing, update bi-directional or with one resource overwriting the other as authoritative, updating non-user entities and keeping them in reference to users, and many more.  This split is designed to identify the most likely cases from the question you asked.

If this is one-time, an option (not ideal) may be to bring the users into an interim D7 instance and then migrate them to D8.  This could be done repeatedly but would require a standing D7 instance to maintain.  I'd only suggest this until the D8 LDAP feeds project is further along.  It could give you time to dig in and contribute as well. ;)

Giving this further thought and since the module isn't fully ported, this could be done with a server cron, a little scripting and a docker D7 instance.  A nightly docker spin up, pull from LDAP into D7 and migrate users to D8.  It's far from a good solution.  But it sounds like your need is immediate and this would work.  If time isn't a factor either porting the module yourself or paying someone to do it is the best path.

I'm happy to amend or expand this answer as needed based on additional information added in your question.


make the sidebars and the "content" region the same length as each-other?

There is the Equal Heights jQuery module.

  This modules implements a jQuery Equal Heights plugin that can equalize the height of the elements of the specified class.


Are there any security concerns with getting the UID by simply querying the sessions table against the visitor's cookie?

The approach is vulnerable to a man-in-the-middle attack but just like any connection that isn't encrypted (HTTP). An attacker could use this to read the comments of nodes they otherwise don't have access to.

Otherwise, without knowing more context of how this used and displayed I can't say there are no other security concerns. I'll comment on a possible XSS issue with your comment display code at http://drupal.org/node/1922406.

I would recommend that you check for the session cookie though:

if (!empty($session_name) && !empty($_COOKIE[$session_name])) {


Have you tried Dhtml Menu?

  Ordinarily in Drupal, in order to see the sub-items in a menu, you
  need to click the link of this item and wait for a full page load.
  After enabling DHTML Menu, clicking a menu link once will expand it to
  reveal its sub-items without reloading the page. A double-click on the
  item will load the page normally. Additionally, a cookie stores which
  menus are open and which are closed, so that the state of the menus
  remain consistent as you navigate around the site.


Views Exposed Filter Sort on Entity based on Term Reference Field from Entity Reference Relationship

So you have two relationships. One to the referenced entity to pull it in, and another on the term on that referenced entity to pull in data such as term names (to sort on term names).

This immediately brings to my mind an issue whereby you will have what seems like duplicate entries coming in. To avoid that you will have to use aggregation, and in the aggregation settings you will have to do a count on one of the fields (which will collapse the result set) and then do an exposed filter.


Synchronous XMLHttpRequest on the main thread is deprecated error at the end of ajax call

I at least found a solution. What I did was add the below again to my webform's tpl file, because that was the one which had stopped working.

$(".messages").on("click", function() {
  $(this).hide();
});


Views is rendered by some of *.tpl.php files, they are:

views-view.tpl.php. Main view template.
views-view-unformatted.tpl.php. Default simple view template to display a list of rows.
views-view-fields.tpl.php. Default simple view template to all the fields as a row.
views.view-field.tpl.php. This template is used to print a single field in a view.

If you want to use two different fields from one view in one file, I recommend to use views-view-fields.tpl.php where you can manipulate of all fields which you assign to view.

The views-view-fields.tpl.php has three variables to use: $view, $fields and $row. I suggest to use only $fields.

Then, if you have field named field_image you can render its using $fields['field_image']->content or $fields['field_image']->raw.

Also, I recommend to read more about it: Views template files


drop migration tables after migration ended

Motivation:

List all tables prefixed with migrate_ in hook_install.
Implement hook_uninstall to remove all tables prefixed with migrate_ except those listed when install the same prefix.

Solution:

The migrate core module must list all tables prefixed with migrate_ during installl.
The migrate module must remove all tables prefixed with migrate_ during uninstall.

drop_migration_tables_during_uninstall.patch implemented the hook_install && uninstall hooks in migrate.install to drop all tables prefixed with migrate except those where found during module installation (may be other contributed or custom modules defines tables prefixed with migrate) which is not a good decision


change the line:

try_files $uri $uri/ /index.php;

to:

try_files $uri $uri/ /index.php?q=$uri&$query_string;

to pass the query_string to drupal.

(see HttpCoreModule for more informations about nginx variables)


I get an solution :
Exposed here in : https://drupal.org/node/109157

I had to add '"access callback"   => TRUE' to my hook menu (TRUE because i want anonymous user get access to the page).

function custom_createAccount_menu()
{
  $items["createAccount"] = array(
    "title"=>t('Create an account'),
    "page callback"    => "_custom_createAccount",
    "access callback"  => TRUE,
    "access arguments" => array("access createAccount content"),
  );

  return $items;
}

and that works.

@SavaryNicolas


The simplist way is to give your users permission to add a node. This would be done through admin/people/permissions.

To get a node to automatically appear on the front page, the publishing options for the content type need to default to 'Promoted to front page'. Set this up when you are creating your content type.

If you want to create a custom form, the method (perhaps not for newbies) is:

(1) Create a module (.INFO and .MODULE files).

(2) Implement hook_menu (in your new module) to create a url and page where the form is to reside.

(3) Add a function to render the HTML of the form using drupal_get_form.

(4) Add a form builder function and construct your form using an array called $form (see form API for details).

(5) Add a submit button at the end of your form.

(6) To make the form look the way you want it to there are several methods: (i) create a theme function to add to the elements of $form; (ii) use #prefix and #suffix properties to add additional HTML and CSS ids/classes to the rendered form; (iii) manipulate the many ids/classes, rendered by drupal_get_form, with CSS; (iv) use the #markup properties to add additional HTML and CSS ids/classes to the rendered form (not recommended).

(7) Add a validation function, if needed.

(8) Add a submit function using node_save (for nodes) and drupal_write_record (for fields) to insert your form values into the relevant database tables: node, field_data_field_my_field etc.


I'm working on the same problem right now so I understand your confusion.  You have a lot of questions, but I think they can be summed up into a singular question:

  How does the Migrate module handle migrating a normalized database
  into a Drupal installation?

It's definitely not straightforward, but here's my understanding of how it works.  We'll start from the top (WineWineMigration) going down and ask questions as we go.

We start off by looking at the code at the top of the WineWineMigration class.

...
$this->dependencies = array('WineVariety', 'WineRegion',
  'WineBestWith', 'WineUser', 'WineProducer');
...

This tells the Migrate module that in order to migrate your Wine content, the dependent migrations - WineVariety, WineRegion, WineBestWith, WineUser, WineProduce - must be completed first.

So what we've learned here is that migrations can be dependent on other migrations.

Next we have the mapping between the table that currently holds the base wine info and the Drupal node:

$this->map = new MigrateSQLMap($this->machineName,
  array(
    'wineid' => array(
      'type' => 'int',
      'unsigned' => TRUE,
      'not null' => TRUE,
      'description' => 'Wine ID',
      'alias' => 'w',
    )
  ),
  MigrateDestinationNode::getKeySchema()
);

This is pretty straightforward so if you need clarification I will provide it.

I'm going to skip over some interim stuff that isn't really pertinent to hooking up the various categories and wine objects.

Now we get to the field mappings.  Observe:

// Mapped fields
$this->addFieldMapping('title', 'name')
     ->description(t('Mapping wine name in source to node title'));
$this->addFieldMapping('uid', 'accountid')
     ->sourceMigration('WineUser')
     ->defaultValue(1);
// TIP: By default, term relationship are assumed to be passed by name.
// In this case, the source values are IDs, so we specify the relevant
// migration (so the tid can be looked up in the map), and tell the term
// field handler that it is receiving tids instead of names
$this->addFieldMapping('migrate_example_wine_varieties', 'variety')
     ->sourceMigration('WineVariety')
     ->arguments(array('source_type' => 'tid'));
$this->addFieldMapping('migrate_example_wine_regions', 'region')
     ->sourceMigration('WineRegion')
     ->arguments(array('source_type' => 'tid'));
$this->addFieldMapping('migrate_example_wine_best_with', 'best_with')
     ->separator(',')
     ->sourceMigration('WineBestWith')
     ->arguments(array('source_type' => 'tid'));
$this->addFieldMapping('field_migrate_example_wine_ratin', 'rating');
$this->addFieldMapping('field_migrate_example_top_vintag', 'best_vintages');

See where it says:

->sourceMigration(...)

This indicates to the migration that in order to map this field, another migration must be satisfied first.  I believe this is the "secondary migration" that you spoke of.  Let's use the region field mapping as the example here.  Breaking it down...

$this->addFieldMapping('migrate_example_wine_regions', 'region')
     ->sourceMigration('WineRegion')
     ->arguments(array('source_type' => 'tid'));

This says that the category region in the source database is mapped to a region vocabulary term.  As the TIP comment states in the field mappings code chunk, it assumes that mappings are made based on field_names, but since we are dependent on a secondary migration as you put it, we need to specify the migration it is dependent on and instruct it to use tids instead of field names.

So pretty much for every normalized table you have in your source database, you're going to be specifying a migration for each, and then in the relevant field mappings that involve those tables, you'll be specifying dependent migrations in your field mapping calls, as well as the dependent migrations declaration at the beginning of each migration.

I hope this helps.  I don't fully understand this myself so I used this question as an opportunity to enhance my understanding of how Migrate relates databases.  As I learn a bit more I'll update my answer accordingly.


https://www.drupal.org/docs/develop/coding-standards/list-of-sql-reserved-words
Maybe "read" should have quotes (``) around it in order for this to work. I am uncertain why this is not done automatically.


Get all the text fields type and alter value after save

Another approach by checking field name. I think this will get you the "custom" field part, but not the "all" fields part:

MYMODULE.module:

use Drupal\Core\Entity\EntityInterface;

function MYMODULE_node_presave(EntityInterface $entity) {
  if ($entity->hasField('field_name')) {
    $entity->get('field_name')->value = preg_replace(
      $toReplace,
      $newText,
      $entity->get('field_name')->value
    );
  }
}

But this only checks for fields of that name. I am also looking for a way to alter the value of a ckeditor/text field by testing field type instead of field name.

I would have hoped setting the field name value to something like text_long would have worked. This is a base field hook suggestion, but I am not having any luck at this time.

To add to the use case, it would be nice to alter ckeditor/text fields whether attached directly to the node, or via a Paragraph type.

The answer in the comment link above is helpful, but I have not succeeded in implementation.


Fast way to get translations of all installed modules

Use the Localization Update module, it will hold all your modules translated and up-to-date.

  Automatically download and update your translations fetching them from localize.drupal.org or any other Localization server.


how to link to sections in the same page?

This isn't so much a Drupal thing as an html link thing.

As you can see from the URL when you click on one of those links, you'll notice that they look like this:

http://eshbeata.com/#about

or

http://eshbeata.com/#works

Note the hash tag and word at the end (#about and #works).

That's called an 'anchor' and is essentially a link to a specific part of a page rather than a link to just the page.

Using anchors requires a two-part setup:

First you have to label the place you want to jump TO with your link.  So, by the exact place in the page that's the 'works' section, the author of that page would have the following:

It's just an empty link that names this spot in the page with the name 'works', and that's precisely what the link below will look for

Second, in the link "Work" in the top menu, there is the anchor '#works' at the end of the link.

Work

Hope this helps.  You can read much more about this online just by searching for something like 'html anchors' or similar terms.


To attach a script in Drupal 8 you need to define a library first in your modules *.libraries.yml (replace * with your modules machine name).
The file should look as follows:

libraryname:
  version: 1.x
  js:
    js/script.js: {}
  dependencies:
    - core/jquery

After that you have the possibilities to attach a script through a preprocess function or directly in the template with a twig function.
I believe you are trying to achieve the first. In that case you need to modify the render array, like in this example:

<?php
function modulename_element_info_alter(array &$types) {
  if (isset($types['table'])) {
    $types['table']['#attached']['library'][] = 'modulename/libraryname';
  }
}
?>

If you want to append a script to every page depending if a custom setting is activated in your module, you should do as follows:

function modulename_page_attachments_alter(array &$page) {
  if ($settingIsTrue) {
    $page['#attached']['library'][] = 'modulename/libraryname';
  }
}

You can read more about it in the manual.


How do I theme user reset password page?

Wooha! I found the answer myself. These are the template file names which can be overridden to theme the pages.

page--user--reset.tpl.php
- To theme the reset password page when you will receive this of reset password URL in the email. /user/reset/2289/1545342420/zrmQkJAN9whwgu2xbKCW0KbIKigx7AsUgSo88UKr1c4

page--user--login.tpl.php
- To reset the user login page.

page--user--pass.tpl.php
- To theme the user password page when user enters the email address to recover the password.

See this for more information as well.
https://www.drupal.org/node/350634


Convert Field Collections into Paragraphs during Migration

As more sites migrate from D7 to D8, this is definitely a needed functionality. I see that there is now a patch for Paragraphs that is attempting to address that: https://www.drupal.org/node/2911241

If you can test and/or contribute, we can get this moving along!


How to filter taxonomy term in views from URL

The best way to do this is as follows:

Assuming you have fields in your content type for continent, country, and city: Add each of these fields separately in your view's Contextual Filters. You can leave them at the default settings for now.

Then, change your path settings for the page to one like such: destinations/% (the % will be replaced with your contextual filters).

After saving the view, you should then be able to visit a path such as destination/europe/france/paris OR destination/europe/france, granted you have content within those areas.


If user leave comment, print "You have already written a comment"

Try this

function custom_cv_node_view($node, $view_mode, $langcode) {
 global $user;
  if ($view_mode == 'teaser') { /* Teaser */
      $cid = db_query('SELECT cid FROM {comment} WHERE uid= :uid AND nid = :nid', array(':uid' => $user->uid, ':nid' => $node->nid))->fetch();
      if($cid) {
          $node->title = $node->title.' (Commented)';
      }
  }
}


How do I construct an authenticated HTTP request in Postman?

You can make use of Token authentication but be careful:

From module description:

  Be careful with what paths you expose to Token Authentication, as it is effectively a very simple, very low security password mechanism. You can expose Administration pages through bad configuration.

Install / enable Token authentication Module.
Go to admin/config/services/tokenauth
Add the path you want to give access to with token.

in the example below i added all add content pages.
Go to admin/people edit the user you want to generate token.
Generate Token by clicking on Token authentication tab it will give a token for that user like ?token=tuvj7cMwauxStWGVQYfo.
Then you can use it with postman.

Note: it may not be the best way.


Some module is adding info below 'Nice Menus'

suggestion from average drupal guy.... try using the module_implements() with watchdog method to check the available hooks from nice menu or menu docs that can cause the change and track the module...hope it helps you in some way


Drupal 7 - dynamic, collapsible, navigation bar/block/thing in the sidebar first

You can use DHTML Menu or Accordion Menu to get the desired effect.

IMO, DHTML Menu is simpler to use.


Ubercart 3: Skip review, single page checkout

I found it myself. The problem was a non-intended change in the ubercart core file uc_cart.pages.inc, so that the function uc_cart_checkout_complete() instantly returned without completing the order. This should not occur in normal cases, so that the code in my question should work.


CSS, Omega theme - how to make a  use 2 or 3 grids depending on screen with?

I don't know if Omega can do this out of the box, but I don't think so.  Some base themes that use the grid system can change a size based on whether a column next to it is empty, but this isn't one of those conditions.

Your best option is to use the grid-2 size in the config for that region, and then if you want it to be different, put an override for mydiv in one of the sheets that get enabled by the media queries (narrow, normal, or wide).  In your case you would add something like

.mydiv { width: 280px; }

to yourtheme-alpha-default-wide.css  The actual width will vary based on whether you are using 12, 16, or 24 columns, and you may need an !important, too.


Make files allow you to connect to SVN repositories as sources for install profiles, modules, themes, and libraries. They do not, however, have built-in support for propget or propset.

Drupal repositories are all git based so I'm afraid SVN support is bulwarked to a bare minimum. See the drush_make documentation for the supported SVN parameters.

As an aside, take a look at update Drupal using Drush with svn support for some other ways to incorporate Drush + SVN into your workflow.

NOTE: It sounds like you're using Drush 4.x and the drush_make extension, so my answer is assuming that is true.


Pull first image from each node to use in view

I've used this regex in my views templates for this task -- it works by grabbing the src from the first image tag in the body content (assumes using fields view style):

$output = preg_match_all('/<img.+src=[\'"]([^\'"]+)[\'"].*>/i', $fields["body"]->content, $matches);
$first_img = $matches[1][0];

if (!empty($first_img)) {
     print "<img src='$first_img'>";
}

You can also pass the source to your imagecache theme function, as Jim and jimajamma suggest, to scale the image.


How to display number of flagged comments for each author

Ok so I found a solution although I am not sure it is the best one. The problem was that the databases for the flag module only stores the comment id (when using a comment flag) and not the id of the authoring user. I am implementing the code in a PHP snippet in author pane template where the comment object isn't available. My solution was to do two queries:

$cid_array = db_query("SELECT cid FROM comment WHERE uid = :user", array(':user' => $account->uid))->fetchCol();
$thank_count = db_query("SELECT COUNT(*) FROM flagging WHERE entity_id IN (:cid) AND fid = 2", array(':cid' => $cid_array))->fetchField();

Thanks to Felix Eve for supportive comments


Autocompleting line-item fields in Drupal commerce

If you change the field from a simple text field into an entity reference field, you can create the different clubs as nodes (seems to make sense, since you could then write info about each club on your site). Entity reference comes with a built in autocomplete.

You could also use taxonmy terms and taxonomy reference field instead if you don't want to create a node for each club. Either way should work just fine, as both have autocomplete built in.


Is it possible to add unlimited values as a group of fields?

For your use case, there is the Field Collection module. The description given in its project page is the following.

Provides a field-collection field, to which any number of fields can be attached.
A field collection is internally represented as an entity, which is embedded in the host entity. Thus, if desired field collections may be viewed and edited separately too.

The latest stable release for Drupal 7 is 7.x-1.2, released on December 26, 2020; it's not covered by the security advisory policy. The development snapshot for that release has been last updated on March 26, 2021.
For Drupal 8, the project maintainers suggest using a different module.

Use Paragraphs and Entity Reference Revisions instead of field collection for Drupal 8 projects.

Since one of those modules doesn't have a release for Drupal 7, that suggestion isn't for users who are running Drupal 7 sites.


Image generation in progress. Try again shortly. (503 service unavailable)

I managed to fix it!

It was a server configuration issue (PageSpeed (bitnami) to be specific).

I tail -fed the access log and saw

xxx.my.ip.xxx - - .... "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_8_5) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/32.0.1700.102 Safari/537.36"

xxx.server.ip.xxx - - .... "Serf/1.1.0 mod_pagespeed/1.6.29.2-"

Figured out definitely something is wrong with server (why is it hitting twice!).

Disabled and it worked fine

# Include conf/pagespeed.conf
# Include conf/pagespeed_libraries.conf

This issue was not happening in the dev site maybe because I have apache basic http authentication enabled (hence pagespeed was not caching it, just guessing).


I got the solution via IRC. Simply install and activate Sub-pathauto.


Show all child nodes of a taxonomy term D7

Actually there's a very easy (built-in) method...

Go to admin/structure/views, find the view named Taxonomy term, and enable it
Go to admin/structure/views/view/taxonomy_term/edit
Click Advanced (on the right)
Click Content: Has taxonomy term ID (with depth)
Select a Depth of 1 or more
Save all your changes

Now, assuming the term id of Brand 1 is 1, when you visit www.yoursite.com/taxonomy/term/1, you should see all the child nodes listed. You can also create path aliases to make paths like taxonomy/term/1 more "pretty".

Hope that helps...

:)


Returning an array of all content types in a folder

If you mean node types, every node type generates (amongst others) a file called node.type.NODE_TYPE_MACHINE_NAME.yml when exporting to config/sync


dupal form: how to assign specific id to radio button using form api

If you need to assign IDs to each radio option, then you can use custom theme function, to theme your radios. See example:

$form['entry.497535900'] = array(
  '#type' => 'radios',
  '#title' => t('Category'),
  '#options' => array('P' =>'Product','S' => 'Services','O' =>'Others'),
  '#theme' => 'mymodule_custom_radios',
);

The #theme parameter specifies function, which overrides the default radios styling function. You will need to define this function in hook_theme() and create the content of the function, where you can specify, how radios should be rendered.

/**
 * Implements hook_theme.
 */
function mymodule_theme($existing, $type, $theme, $path) {
  return array(
    'mymodule_custom_radios' => array(
      'arguments' => array('element' => NULL),
    ),
  );
}

Then create the content of this function.

function theme_mymodule_custom_radios($element) {
  // You can access all radios options like this - $element['#options'];

  $output = '';
  // ... create html output according to your needs
  return $output;
}


You don't have to inject services in the controller, because ControllerBase already provides the services needed. So this should work:

$user = $this->entityTypeManager()->getStorage('user')->load($this->currentUser()->id());

For other services not included in ControllerBase, see How do I use dependency injection on \Drupal::moduleHandler() to a Controller?


Can I prevent Administrators from Updating Modules?

Uncheck the permissions "administer software updates" from roles, and they should no longer have access to this screen in the admin.

At the same time, it is advised to use drush or other methods of applying updates, as the admin screen is pretty not great for this.


How do I integrate custom PHP application with Drupal?

If your application can be displayed inside a Drupal page, writing a small custom module is the easiest clean solution. You don't need to rewrite your application, but only to provide some integration code. Your application should avoid output the complete HTML for the page, only its own content. It should also not initialize the PHP session as Drupal will take care of that. Otherwise it is as simple as:

/**
 * Implements hook_menu().
 */
function your_application_menu() {
  return array(
    'title' => 'Your Application',
    'page callback' => 'your_application_page',
    'access callback' => TRUE,
    'type' => MENU_CALLBACK,
  );
}

/**
 * Page callback: Displays Your Application on the page.
 *
 * @see your_application_menu()
 */
function your_application_page() {
   module_load_include('php', 'your application', 'your_application');
   $path = drupal_get_path('module', 'your application');
   drupal_add_js($path . '/js/angular.js');
   drupal_add_js($path . '/js/your_application.js');
   drupal_add_css($path . '/css/your_application.css');
   return your_application_output();
}

You may also be interested by the Angular JS module, which likely provide a much nicer way to embed Angular JS applications in Drupal.


How to migrate an admin.inc file which creates a configuration form for settings?

system_settings_form() is replaced by \Drupal\Core\Form\ConfigFormBase in D8.

you can see
https://www.drupal.org/node/1910694
Working with Configuration Forms

Example:

namespace Drupal\example_module\Forms;
use Drupal\Core\Form\ConfigFormBase;
use Drupal\Core\Form\FormStateInterface;

class StudentConfigForm extends ConfigFormBase {
  // The Form ID that is used in alter hooks.
  public function getFormId() {
    return 'student_config_form';
  }
  // Configuration names that will be editable
  public function getEditableConfigNames() {
    return ['example_module.student'];
  }

  public function buildForm(array $form, FormStateInterface $form_state, $args = '' ){
    $config = $this->config('example_module.student');
    $values = $config->get();
    $form['student'] = array(
      '#type' => 'details',
      '#title' => $this->t('Student'),
      '#open' => TRUE,
      '#tree' => TRUE,
    );
    $form['student']['first_name'] = array(
      '#type' => 'textfield',
      '#title' => $this->t('First name'),
      '#default_value' => $values['student']['first_name']
    );
    $form['student']['last_name'] = array(
      '#type' => 'textfield',
      '#title' => $this->t('Job title'),
      '#default_value' => $values['student']['last_name']
    );
    $form['student']['age'] = array(
      '#type' => 'textfield',
      '#title' => $this->t('Age'),
      '#default_value' => $values['student']['age']
    );
    return parent::buildForm($form, $form_state);
  }

  public function submitForm(array &$form, FormStateInterface $state) {
    $values = $state->getValues();
    $config = $this->config('example_module.student')
      ->set('student', $values['student'])
      ->save();
  }
}


Entity Reference widget selctor in view referring same reference

I couldn't test all the way with Entityref Views, I seem to have a bug in choosing Views on my Field settings. But I was able to create the Views and it works as expected in Views preview.

The goal is to create Views of sibling nodes. In your case we need to list Person nodes that are sibling nodes to the Service node you're currently viewing. They are sibling through the Agency Entity reference field (they both refer to the same Agency node).

When both References to Agency are the same field

This is the case when the references to Agency from both Service and Person are the same field, reused (this happens when you create one ref field on one content type, then on the other content type you choose from the second drop-down "Re-use an existing field").

Create Content Views showing Person. You don't need Page nor Block, add Entity reference Display.
Show Fields Title and Agency (to test filtering works as expected, you can remove Agency later)
Under "Entity Reference inline fields" set Separator to from (with spaces on each side) so you get meaningful output Person: Name1 from Agency: Agency1
Add a Relationship Content referenced from field_agency, you can require it. This is the Agency a Person listed in Views is referring to.
Add another Relationship Content using field_agency, set it to use the Relationship from the previous step, you can require it. This is the reverse direction, pointing to all content that is pointing to this Agency.
Add a Contextual Filter ID from Content Category and set it to use the second relationship (field_agency) and configure:
When the filter value is NOT available
Provide default value
Content ID from URL
When the filter value IS available or a default is provided
Specify validation criteria
Service
Configure Entity ref field settings to use this View, and choose the widget on "Manage form display".

That's it! You can test Views through Preview by entering one of the Service NIDs. Don't forget to add some "No results" text.

The Views will list only Person that are in Agency that this Service is referring to.

When References to Agency are NOT the same field

This case is when you created two different Entity reference fields on Service and Person (they have different machine names). Configuration is a bit different even though they refer to the same Agency.

You create Views the same as above only with these differences:

The first Relationship needs to be of the Entity reference to Agency that is on the Person CT.
The second Relationship needs to be of the Entity reference to Agency that is on the Service CT.

Again this second Relationship must use the Relationship from the previous step. This is where the magic happens, where Service and Person Agency fields are compared.

The Contextual ID Filter needs to be using the second Relationship, as in the first case. This Contextual is only passing on the Service ID of the page you're on to Views.


How to display both the taxonomy parent and child in a node?

The answer you linked is correct. You need to write .tpl.php file and use provided code in place of default taxonomy renderer. In Drupal nodes belongs only to explicitly selected taxonomy element, not to it's parents. It was the design decision.


Images loading from server on every page load

Caching problem was not with the views, it was actually Adaptive Image module which was causing the frustrating image reload issue.

After trying several caching options, I disabled the Adaptive Styles and use normal image styles and the issue was resolved.

For adaptive images I am now using Adaptive Image Styles and it is working fine. Though this require some modifications in .htaccess file but that is acceptable.


Would it be something like this?

db_update('system')->
  expression('filename', 'replace(filename, :old, :new)', array(
    ':old' => 'sites/all/modules/contrib',
    ':new' => 'profiles/distroname/modules/contrib'
  ))
  ->execute();


How to Schedule a node "Promoted to front page"?

You can do this using the Rules module in combination with the "Rules Scheduler" (a submodule of it). After you enable these 2 modules, create a Rules Component and a Rule. Here is a blueprint of doing so:

Create a Rules Component which accepts "node" as a parameter, and which has a Rules Action to set the node to "published".
Create a Rule like so:

Rules Event: Before saving a new node.
Rules Actions: (1) set the node to "unpublished" (to be sure it is not "published" when the node is saved) and (2) schedule the Rules Component created in the previous step.

Note: From the comment below this answer (which states "The node will remain Published all the time.") it doesn't seem to apply for the question here, but using a similar approach you could also schedule another Rules Component to mark it unpublished again later on, eg X days after the node gets published. In that case, you use Rules Event "After updating an existing node", combined with a Rules Condition to check if the update changed "unpublished" to "published".


Is there a module/hook for permissions for list values?

This is Drupal 7 solution

Using hook_form_alter, you can unset some of the options based on the user role.
For example look at this list of article content type  (field_list)

It is the result of kpr() on its form

simply use this code

function THEME_form_alter(&$form, &$form_state, $form_id){
    global $user;
    if($form_id == "article_node_form"){
        //kpr($form);
        if(in_array('SOME_ROLE', $user->roles))
            unset($form['field_list']['und']['#options'][2]);
   }
}

This is the result


Make URL from 1 field available to another field [Drupal 8]

If you want to get a field value from another field in a field template you have to use the parent entity (in your case a node) element['#object']:

{{ element['#object'].field_textfield.value }}

or a url from a link field:

{{ element['#object'].field_linkfield.0.url }}


How to display a link field with its link text in a twig template

{{ node.field_link }} and {{ node.field_link|render } crashes because node.field_link of type FieldItemList not a rendered array.

Instead of using node variable use content variable like {{ content.field_link }} or even {{ content.field_link.0 }} it works.


Retrieve contents from a JSON URL using cURL and display them in an HTML table

Have you tried drupal_json_decode? drupal_json_decode give you back a object that you can use for  print the variables.

https://api.drupal.org/api/drupal/includes!common.inc/function/drupal_json_decode/7


Install module that requires composer on server with only FTP

That error message is called from the modules install file.  It's checking to see if the PHPMailer class exists, and if not, let's you know the library needs to be installed before you can install the module.

If you successfully installed the module on your local dev site, then Composer downloaded the PHPMailer library to the root 'vendor' folder.  In the 'vendor' folder there should be a 'phpmailer' folder.  You just need to copy this folder over to your website's server (to it's root 'vender' folder) and then you should be able to install the module.


How do I add a custom html.node--.html.twig based on content-type?

You can use hook_theme_suggestions_HOOK_alter() to add another suggestion, something like:

function THEME_theme_suggestions_html_alter(&$suggestions, $variables) {
    // Check it's a node page.
    if (($node = \Drupal::routeMatch()->getParameter('node')) && $node instanceof \Drupal\node\NodeInterface) {
        // Insert as second to last so the more specific template by ID still works.
        array_splice($suggestions, count($suggestions) - 1, 0, 'html__node__' . $node->getType());
    }
}


Accessing Login page shows You are not authorized to access this page


X-Drupal-Route-Normalizer: 1

That's either the redirect module or the corresponding core patch, I guess the first.

There have been a bunch of bugs in the past about this but it should work now if you update to the latest version.

This for example someteimes happened with different url query parameters, or a trailing ?, e.g. "some/url?", redirect.module redirected that to /some/url but the page cache in Drupal core actually cached it for a normalized URL without ?, so it cached a redirect to /some/url as /some/url, and then you have your redirect loop.

If you can still reproduce with the latest redirect version, then open a bug report. Also make sure that you are not using a Drupal 7-style configuration for nginx (that e.g. adds a ?q=path qery parameter)


Table 'watchdog' was not locked with LOCK TABLES on custom module

This won't work with the current code. It is not the reporting that is the problem, but the implementation of locking.

From mysql lock tables reference

  A session that requires locks must
  acquire all the locks that it needs in
  a single LOCK TABLES statement. While
  the locks thus obtained are held, the
  session can access only the locked
  tables.

You are trying to access unlocked tables while holding a lock.

I can't say that I have used it in the wild but there is a Drupal specific  locking mechanism that you may want to look at instead.


Views grid output is top-to-bottom, not left-to-right?

I am pretty sure you need to change the display of your grid from horizontal to vertical or vice-versa. You may also have to play with the "fill up single line setting".


How do I set "has_title = false" for an existing node?

There is good comment in source:

// title_label is required in core; has_title will always be true, unless a
// module alters the title field.
$type->has_title = ($type->title_label != '');

So, you can alter the form and customize it.
I have created a simple example, because I found it interesting.

/**
 * Implements hook_form_FORM_ID_alter().
 * Alter 'node_type_form'
 */
function nodetitle_off_form_node_type_form_alter(&$form, &$form_state) {

    $type = $form['#node_type'];
    $default_value = $type->has_title;
    // Create simple flag
    $form['submission']['nodetitle_off'] = array(
        '#type' => 'checkbox',
        '#title' => t('Has title'),
        '#default_value' => $default_value,
        '#weight' => -1,
    );

    $value = !empty($form_state['input']) ? isset($form_state['input']['nodetitle_off']) : $default_value;
    if (!$value) {
        // Make field not required and empty
        $form['submission']['title_label']['#required'] = FALSE;
        $form_state['values']['title_label'] = '';
    }

}


Notice: Undefined index: province in eval() (line 1 of /pathtomodule/views/plugins/views_plugin_argument_default_php.inc(49) : eval()'d code).

This error occurs when the array key province does not exist. The PHP documentation goes into greater detail - http://www.php.net/manual/en/language.variables.basics.php

  Relying on the default value of an uninitialized variable is problematic in the case of including one file into another which uses the same variable name... E_NOTICE level error is issued in case of working with uninitialized variables, however not in the case of appending elements to the uninitialized array. isset() language construct can be used to detect if a variable has been already initialized.

Instead of

return $_GET["province"];

Use isset() logic. Also, you shouldn't be directly accessing $_GET, $_POST or $_REQUEST; best practice is to use drupal_get_query_parameters()

$param = drupal_get_query_parameters();
if (isset($param['province'])) {
  return $param['province'];
}
return NULL;

To address the problem in your comment:

  But i receive: Notice: Undefined offset: 1 in location_handler_argument_location_proximity->query()

This is (for all intrinsic purposes) the same as the undefined index; location_handler_argument_location_proximity->query() is expecting an array with at least two elements (offset 0 and 1), and that method expected, but did not receive an array with two elements. It might not even be getting an array.


How to show a map of the User's Location in the User's profile with Address Field and Geofield

Use module getlocations.  It also supports paths like "/getlocations/user/xxx" and "/getlocations/users" for location-enabled users


If you enable the Trigger and the Flag actions modules, you can assign a group of actions that is executed when a user or a node is flagged by a user.
Flag integrates also with Rules, and it allows to execute rules when a flag is used for users or nodes.


Can we customize user login block in Hybridauth module

There are two template files used

hybridauth_widget.tpl.php

This one is used to create the list of the icons. It gets a variable called $providers which has all the enabled providers.

hybridauth_provider_icon.tpl.php

This one is used to print the individual icons. Two variables are used here. $provider_name is the name of the provider like facebook twitter etc. and $icon_pack_classes which has the current selected icon pack classes.

These template files can be found in with in the templates folder of the module.

You can make copy of the same in your theme and make the required changes.


How can I generate a list of PDF Forms based on user input?

It may not be the best way, but an easy way to do this would be to use core's taxonomy module. From the module's docs: "Taxonomy, a powerful core module, gives your sites use of the organizational keywords known in other systems as categories, tags, or metadata. It allows you to connect, relate and classify your website’s content."

In a nutshell, I'd suggest to create a taxonomy vocabulary for your type of workers, and add a term for each (hourly, salary, etc.) and attach a file field to the vocabulary, where you can upload and attach the PDFs for each term. Then on the front end, you can create a view that lists all of the file fields attached to that term.


Term reference field - print as other format

EDIT: I didn't completely get your question initially. To do this you will need to fetch the term names yourself, and make them available to your node template file. This means you'll have to use hook_preprocess_node() implementation.

Here's the code you'd use:

function YOUR_THEME_preprocess_node(&$variables) {
  if ($variables['node']->type == 'YOUR_CONTENT_TYPE' && isset($variables['node']->field_event_speakers[LANGUAGE_NONE][0]['tid'])) {
    $event_speakers = array();
    foreach ($variables['node']->field_event_speakers[LANGUAGE_NONE] as $event_speaker) {
      $term = taxonomy_term_load($event_speakers['tid']);
      // Just to display the name:
      $event_speakers[] = $term->name;
      // To display linked name instead, use this:
      // $event_speakers[] = l($term->name, 'taxonomy/term/' . $term->tid);
    }
    // This will separate names with a comma, and a space.
    $variables['event_speakers'] = implode(', ', $event_speakers);
  }
}

You can then use this as many times as you want in the template; example:

<?php print $event_speakers; ?>

<?php print $event_speakers; ?>


Preprocessed block not udpating after edit

Drupal 8 caching background in breif:-

Drupal 8 has strong and awesome caching mechanism.

Basically any renderable array is now get cached by default and drupal provides cache API to manage in what context
(could be in context of user/route etc.)(cache contetx), when to invalidate the cache(cache tags) and till when it should
be cached could be Permanent cache(max-age=-1) or no caching at all(max-age=0)

So the renderable array Cache API works around

Cache Context
Cache Tags
max-age

The problem with my code was excessive preprocessing on block content and then avoid {{ content }} to print on block
twig template, so {{ content }} itself take care of '#cache' attribute but since I avoided it during preprocessing
and printed only my custom exposed variables drupal was never able to figure out when to invalidate the cache, and
blocks were permanent cached.

Solution:
I just made sure I am also passing the '#cache' attribute to my renderable arrays and then used the same on twig template

  // - Example during preprocessing

    /**
     * Implements hook_preprocess_block().
     */
    function cfr_world_aboutus_preprocess_block(&$variables) {
      $act_on_blocks = array(
        'myblockid',
      );
      if (!in_array($variables['elements']['#id'], $act_on_blocks)) {
        return;
      }
      $block = $variables['elements']['content']['#block_content'];
      $body = $variables['content']['body'];
      switch ($variables['elements']['#id']) {
        case 'myblockid':
          $variables['myblock_data']['field_title'] = t('Credits');
          $variables['myblock_data']['field_description'] = $body;
          // Added drupal cache attribute
          $variables['myblock_data']['#cache'] = $variables['elements']['content']['#cache'];
          break;
      }
    }

    // - On Twig template
    <div{{ attributes.addClass(classes) }}>
      {{ title_prefix }}
      {% if label %}
        <h2{{ title_attributes }}>{{ label }}</h2>
      {% endif %}
      {{ title_suffix }}
      {% block content %}
        {# Added to pass cache attribute#}
        {{ myblock_data| without('field_title','field_description') }}
        {% include "@mytheme/myblock-partial" with {
          "title": myblock_data['field_title'],
          "content": myblock_data['field_description'],
        } only %}
      {% endblock %}
    </div>


How would I apply a transition to a State Machine field?

Here's what I ended up with. Would be curious if the community has a better solution.

/* @var \Drupal\user\Entity\User $user */
$user = User::load(\Drupal::currentUser());

/* @var \Drupal\state_machine\Plugin\Field\FieldType\StateItemInterface $state */
$state = $user->get('field_screening_status')->get(0);

$transitions = $state->getTransitions();

if (array_key_exists('mark_needs_screening', $transitions)) {
  $user->set('field_screening_status', 'needs_screening');
  $user->save();
}

UPDATE: Thanks to @lisastreeter in #commerce on drupal.slack.com

$user = User::load($id);
$state = $user->get('field_screening_status')->first();
$transition = $state->getWorkflow()->getTransition('mark_needs_screening');

if ($transition) {
  $state->applyTransition($transition);
}

Not sure if that get(0) change to first() really made the difference, but it works now.


Documentation & Background Knowledge is Limited

It's the truth, we are an organization moving from Ubercart on Drupal 6 to Commerce V2 on Drupal 8.  There's a steeeep learning curve.

So, our situation is that we want local businesses to upload a graphic as part of their sponsorship.  Eventually, we will use this image as part of an advertisement block, but at the moment, our question, HOW do we get this image upload as part of a product.

Assumptions

Drupal 8 installed, with Commerce installed V2.

Steps to Create Upload Field (Image)

Create Order Type - I created an Order Type "Sponsorship".  I used the Default workflow (might have to change in the future).  DONE
Create Order Item Types - I created an Order Line Type, named it "Sponsorship", and selected Order Type "Sponsorship".

Then I went to Manage Fields for the Order Item Type "Sponsorship" that I just created and added an Image field to that Order Item Type.
I named the Field "Ad" - as this should be an image uploaded by the sponsor.

Product Variation Type - Because I have other products, I wanted a stand along variation for the "Sponsorship".

I created a Product Variation Type - Advertisement, as I felt I had used Sponsorship too many times.  When I created that Advertisement variation, I ensured that I selected Sponsorship from the Order types.
I was a bit lost here, but a key point, create the product type variation BEFORE creating the Product Type.

Product Type - I then created the Sponsorship Product Type, selecting Advertisement as the Product Variation.
I finally created by product Front Page Sponsor and when doing so I selected Sponsorship as the Product Type, and completed the balance of the product as normal.

I hope this helps others as well..


Use getclicky to have most views nodes on home page

I end up using google analytics reports. and added the top page view in my homepage.


Excluding Book children from a Custom view

This can be done with Normal filter in views.

Following is the configuration of the filter UI, You need to separate the both content type in the filter with OR and in the Content Type: Book page you need to Book: Depth = 1.

Now in the following image you can see the Article and Book page titles, First one without Book: Depth =1, Second one with Book: Depth =1.

Hence, You can see the views fetches the all articles and only parents books page.


How to redirect to frontpage from a controller

Use the route <front> and when you are in a controller use the injected method redirect():

return $this->redirect('<front>');


Automatic Nodetitles IF php statement in between other tokens in title

I tried your snippet and could reproduce the problem.
What worked for me was printing/echoing instead of returning.

My code that reproduced the error:

[current-user:name]
,
<?php
$floor= '[node:nid]';
$ground = '[node:created]';
if (empty($floor)) { return $ground; }
else { return " Floor floor"; }
?>,
[current-page:url]

produced the title "admin, Floor 228".

My updated code (echo instead of return) worked:

[current-user:name]
,
<?php
$floor= '[node:nid]';
$ground = '[node:created]';
if (empty($floor)) { echo $ground; }
else { echo " Floor $floor"; }
?>,
[current-page:url]

and produced the  title "admin, Floor 228,http://localhost/drupal/node/228/edit"

Verdict: I believe this is expected behaviour following from the use of return; it exits the current code block, and therefore the rest of the code is never executed.

Hope this helps!


How do I show a view item as grid and view item as list, dynamically?

Install and configure the Views Mode module.

  A Drupal Views display plugin which provides alternate display modes
  that can be switched to for a single View. This allows exposed filter
  parameters or contextual filters to be kept active while switching
  display mode.

To get this module to work, follow these simple steps:

Activate the modules.
Create a view.
Select your view, then create 3 different display, 1 page and 2 modes (one of the mode should be identical to the page display, since it's the 'default' mode).
Within the Advanced settings of the mode displays, you will find a new section called 'mode settings'.

4a. Attach your modes to your page's view

4b. your mode id is a value that'll be displayed within the url, therefore use only lowercase and normal chars (e.g. 'stickers').

4c. your mode name is the one that'll be displayed in your mode changer block, this can be anything.

4d. For consistency, change the system names of your view's mode displays for their mode ID (4b), they'll be easier to identify.
If everything's going well, visit admin/config/search/purl.

5a. You should see 3 tabs (param, modifiers & types).

5b. Select the third tab first (types) and select the 'query string' option.

5c. Within the Settings tab, select the 'Query string' modifier type, and write 'mode' in the 'key' field (this is the word that'll be displayed within your url, in my case it would look like www.site.com/view?mode=stickers).
Now all you need to do is to add the 'Views mode links' block to your view's page (you should see links appearing on your view's page).

This module does not work with an AJAX enabled pager.


How do I get the file URI from an EntityMetadataWrapper object?

Big thanks to MPD for pointing me in the right direction. In short, without the File Entity module, files aren't entities, so they don't naturally have the 'properties' I was expecting.

The Entity module provides some on their behalf, but URI isn't one of them. Fortunately it's very simple to make it available using hook_entity_property_info_alter() and a custom property callback:

function MYMODULE_entity_property_info_alter(&$info) {
  $info['file']['properties']['uri'] = array(
    'label' => t("URI"),
    'description' => t("The URI of the file."),
    'getter callback' => 'MYMODULE_entity_get_file_properties',
    'schema field' => 'uri',
  );
}

function MYMODULE_entity_get_file_properties($file, array $options, $name) {
  switch ($name) {
    case 'uri':
      return $file->uri;
      break;
  }
}

After that, $images[0]->file->uri->value() is available as expected.


If you want to theme a form, better override the form.html.twig template, because you don't know what happens in the background of this template and you don't want to do this all from scratch in your own template.

So put the complete form in the block:

public function build() {
  return \Drupal::formBuilder()->getForm('Drupal\boutique\Form\AjoutPanierForm');
}

And copy the form.html.twig in your template and change it.


How to transmit parameters to Rules Component upon using Rules Scheduler programmatically?

Fortunately, I managed to find the solution.

Namely, a Rule component should be created such way.

function yrv_invitation_coupon_default_rules_configuration()
{
    $configs = [];

    $rule = rule([
        'uid' => [
            'type' => 'integer',
            'label' => t('User ID'),
        ],
        'rid' => [
            'type' => 'integer',
            'label' => t('Role ID'),
        ],
    ]);
    $rule->label = 'YRV Invitation coupon test Rule';
    $rule->class = 'Rule';
    $rule->action('yrv_invitation_coupon_user_remove_role', []);
    $rule->active = TRUE;

    $configs['yrv_invitation_coupon_test_rule'] = $rule;

    return $configs;
}


What you want is to build a custom widget for the file field type, that has a checkbox that says "this file should be private". Drupal 7 natively handles per-file public/private upload, so at this point it is nothing more then a UI issue.

It has been stated that Private Upload will not be ported to Drupal 7, but I think this is wrong. It should be ported and provide two features:

An upgrade path from the custom, hackish, storage of private files in Private Upload to proper private files (this is not going to happen by magic)
A custom widget that allows the user to choose between public and private during upload


How to resolve the error encountered while trying to import a rule using the Rules module?

Your rule is looking for a field on the user entity type called "field_warnings". That field doesn't exist, or can't be found for whatever reason, so the import will fail.

You need to either add the field, or find out why Drupal can't find it, to continue with the import.


Logintoboggan- Providing the one-time login link in an admin view

This is not an ideal way to do this, but since I am using the Panels module to display user profiles, I created a new variant for unverified users and added a piece of custom content on the variant (with a visibility rule restricting it to admin users) that showed the validation token.

Then I added a link on the view to the user profile; this is two steps instead of one, but at least it is a working solution.


Different commerce payment paypal settings on dev and live sites

This is a question that has came in different shapes, I'd recommend reading https://drupal.stackexchange.com/a/118316/2322 answer to get a better understanding on how drupal commerce and rules store this information. I don't know how to access the UI form the action itself.

Instead of trying to modify specific values, what I'd do is to try to replace the whole rule object with the one you want using entity_import of the rules_config object, something like:

if (isset($configs['commerce_payment_paypal_ec'])) {
    $configs['commerce_payment_paypal_ec'] = entity_import('rules_config', '{ "commerce_payment_paypal_ec" : {
        "LABEL" : "PayPal Express Checkout",
        "PLUGIN" : "reaction rule",
        "OWNER" : "rules",
        "TAGS" : [ "Commerce Payment" ],
        "REQUIRES" : [ "commerce_payment" ],
        "ON" : { "commerce_payment_methods" : [] },
        "DO" : [
          { "commerce_payment_enable_paypal_ec" : {
              "commerce_order" : [ "commerce-order" ],
              "payment_method" : { "value" : {
                  "method_id" : "paypal_ec",
                  "settings" : {
                    "api_username" : "1",
                    "api_password" : "",
                    "api_signature" : "",
                    "server" : "sandbox",
                    "currency_code" : "EUR",
                    "allow_supported_currencies" : 0,
                    "txn_type" : "auth_capture",
                    "ec_mode" : "Mark",
                    "shipping_prompt" : "0",
                    "log" : { "request" : 0, "response" : 0 },
                    "ipn_logging" : "notification",
                    "receiver_emails" : "",
                    "reference_transactions" : 0,
                    "ba_desc" : "",
                    "show_payment_instructions" : 0,
                    "update_billing_profiles" : 1,
                    "enable_bml" : 0
                  }
                }
              }
            }
          }
        ]
      }
    }');
  }


How can I get hold of the Composer object?

Usually, I'm doing this using ReflectionClass.
Take this example: to load the cacert file which comes inside one of composer packages:

First, locate any class in that package using ReflectionClass.
Secondly, get the package path using dirname bypassing the file name.

Code example:
// Load certificate file.
$reflection = new \ReflectionClass(\GSRequest::class);
$packagePath = dirname($reflection->getFileName());
$gsRequest::setCAFile(realpath($packagePath . '/cacert.pem'));


I solved this issue.  The problem was that one has to look in the "spam" folder to see email that is sent by automated means.


Features: Check if you have Path Breadcrumbs module checked in Features Settings (screenshot below). If it was checked and you still do not see it in the Features components list than something else is amiss.

Export: As for the direct export of Path Breadcrumbs, you can find "export" link while clicking on "edit" in path breadcrumbs actions list (screenshot below)

Hope this helps.


How to translate a database query with a subquery to a db_select statement?

SelectQuery::where() takes a string (not an object).

You probably meant to use SelectQuery::condition():

$subquery->fields('a')
  ->condition('language', $language)
  ->orderBy('eid')
  ->orderBy('vid', 'DESC');

Your execution is slightly off too; at the moment you're discarding the results of the execution, and instead invoking fetchAllAssoc() on the wrong type of object.

What you need is

$keywords = $query->fields('ev')
  ->groupBy('keyword')
  ->execute()
  ->fetchAllAssoc('keyword', PDO::FETCH_ASSOC);

or

$result = $query->fields('ev')->groupBy('keyword')->execute();
$keywords = $result->fetchAllAssoc('keyword', PDO::FETCH_ASSOC);

Or some other derivative of the same logic.

After those changes you should wind up with

SELECT  ev.*
FROM
(SELECT  a.*
FROM
{custom_keywords_entity_values} a
WHERE  (language = 'en')
ORDER BY eid ASC, vid DESC) ev
GROUP BY keyword

Pretty close to your original, and functionality identical.


Loading dependencies from the vendor directory in a module using composer

Composer Manager is just a small wrapper around the Merge Plugin which we have in core nowadays.

Register your module in the root composer.json of your project, look for extra > merge-plugin > include. It should look like this:

"extra": {
    "_readme": [
        "By default Drupal loads the autoloader from ./vendor/autoload.php.",
        "To change the autoloader you can edit ./autoload.php."
    ],
    "merge-plugin": {
        "include": [
            "core/composer.json",
            "modules/facebook_ratings/composer.json"
        ],
        "recurse": false,
        "replace": false,
        "merge-extra": false
    }
}

modules/facebook_ratings/composer.json is the path to your composer.json. It depends on where you have your module.

Run composer install afterwards.


How to send email to "anonymous" user when a new node is created

Simplenews looks like it would work perfectly for this.

  Simplenews publishes and sends newsletters to lists of subscribers. Both anonymous and authenticated users can opt-in to different mailing lists. HTML email can be sent by adding Mime Mail module.


Summary
I think you just need a couple of different views to create most of the functionality, but because the continent paths do not leave space for a path argument to call the view (eg example.com/viewname/africa/...), you might need to either duplicate the view with several displays or use some .htaccess mod_rewrites to point continent names at the view.
I have inserted a + into the first path (I hope that is alright?)
Suggestions
view: terms_by_continent

http://example.com/africa/news+politics
http://example.com/europe/reviews
http://example.com/antarctica

are presented by a view called terms_by_continent, with a contextual filter on term:name, accepting multiple arguments and defaulting to 'show all'. Create a different 'page' display for each continent so you can change the path to simply, for example, africa
view: terms_by_category

http://example.com/news/politics

would be a view called terms_by_category. The namespace is a bit difficult here because, unlike continents, I would guess this vocabulary might be subject to change, so creating multiple views displays would be tiresome and prone to error. If you are able to insert another path component then this becomes easy, ie category/news/politics would be served by a view of nodes with a contextual filter as above.
Multiple terms would normally be seperated with a + or similar, but if you needed to use / (ie news/politics) you could do a mod_rewrite on category/* to make this presentable
If you could not afford to add the category path component then I would guess you are stuck with using views displays as in term_by_continent to claim the paths that match each of your terms, accepting arguments for additional terms.
node: custom path
Finally:

http://example.com/2013/12/17/conflict-in-kongo-continues

This is the actual path to a specific article (node), so path auto is definitely the way to go. It will allow you to use tokens to construct your path for the appropriate content type, using date components and title.
Other solutions
I had a couple of other suggestions:

look at page manager, which might allow you to have greater control over paths for your views
you could try using pathauto for terms as well as nodes, and then replacing the term display with a view that accepted term:name as argument (as above), You could do this using term display or tvi

For option 2, I believe that (assuming there is not an existing page with this path), africa/news/politics for example, would not find a match, so would look for africa/news. Because that path also does not exist, it would fallback to africa, which (thanks to pathauto) takes you to the africa taxonomy term.
The term page contains a view, which accepts arguments (ie news/politics) and therefore you should get the appropriate listing. The view might need several displays which accept increasing numbers of arguments in order to allow the '/' seperated arguments, ie view/%,view/%/%, view/%/%/%


How do I make a $node object properties available in my views--template?

Views doesn't load the complete $node object for performance reason. Instead, it build, or attempt to build, an optimized query to only load the fields configured in the Views.

When editing the views, you should have a Fields block. In this block, use its Add fields links to add the additional fields you want to use in your template. If you don't want to display these fields using Views itself, be sure to configure them to be excluded from display.


How use views exposed filters with taxonomy and panels

Not sure if you did this already under the "MORE" section.


That is fairly straight forward. The watchdog table - the system log for Drupal - is missing from your production environment. The real question is really how are you deploying your site. Whatever method you are using doesn't seem to be working properly. If this is a brand new site it would be better to deploy as an install and add all of your customizations as Features.


Easy Question: Filter a View By Tax Term Menu Style Not Exposed Filters

You can use the /match-previews/% as a contextual filter (advanced tab).  Here is a good tutorial on setting it up (http://www.metaltoad.com/blog/using-drupal-contextual-filters-views)


Try going to http://yoursite.com/update.php and execute the form submit.

If this does not work, you must:

disable rules by SQL command:

UPDATE system SET status = 0 WHERE system.name = 'rules';
Execute drush cc all
Active drush again:

Drush en rules -y


Removing Email Address Required Field for Anonymous Users in Drupal Commerce

You can disable Account info section by dragging it to disable section by visiting page 'admin/commerce/config/checkout'.

As in the screenshot Account Information is in Disabled instead of Checkout which is default configuration.

But remember there is a default rule which tries to create an account for anonymous user using the email id, you might have to disable it, or may have to turn in conditional.


Block

Define region in theme information file (https://www.drupal.org/node/171205).

Example: regions[main-menu] = Main Menu
Call the region in template file (html.tpl.php or page.tpl.php)

Example: <?php print render($page['main-menu']); ?>
Clear website cache

Procedure:  Configurations -> Performance -> Clear all caches
Now you can assign any block to the region.

Procedure: Structure -> Blocks -> Here you can see 'Main Menu' region as unassigned. Assign any block to this region (example: assign menu menu block to main menu region).

Templating

To know more about templating: https://www.drupal.org/documentation/theme

Since you are coming from a WordPress background, please get familiar with theme structure of Drupal and then start working on themeing.


How do I solve extra characters in a date format?

I needed to add the escape characters and then go back in and reassign the format to the type.  Just changing the format didn't solve the problem.


What you need is to create a custom views access plugin. I found a blog post that contains the basic information about how to do that here: http://techcp.wordpress.com/2011/01/11/adding-custom-access-plugin-to-views-in-drupal/

You then need at least need to do two specific things:

a) Extend it so that the access callback function receives the second url argument as the argument (in function get_access_callback(), change array() to array(1)).

b) In defined access callback function, check if there is a relationship between the currently logged in users and the uid that gets passed in, by using user_relationships_load() (documentation is for D7, but very similar in D6). Something like this (untested):

function your_access_callback($uid_viewed) {
  global $user;
  $params = array('between' => array($user->uid, $uid_viewed));
  return (bool) user_relationships_load($params, array('count' => TRUE));
}

That should already be enough to make it work four your case. However, this sounds like an interesting improvement to UR in general, for this, two additional things would be necessary.

c) Allow to configure which argument is the user id. Maybe there are also other ways where it could come from (if the view is displayed as a block for example). Not sure how to do that.

d) Allow to configure which relationship type should be checked. Expose a form element for that in the options and then pass the chosen relationship type id to your access callback and in there to user_relationships_load().


Restricting node reference values to owner

If I understand you right, you can use a View as the source for the nodereference widget, and give it appropriate filters to only show nodes of a certain type authored by the current user. To use a view (assuming you have Views installed and appropriate perms) you can

edit the nodereference by going to Content management -> Content types -> Edit [whatever content type] -> Manage fields -> [whatever field name];
in the fieldset Global settings click to expand the fieldset Advanced - Nodes that can be referenced (View);
select the appropriate view in View used to select the nodes;
if you want to use arguments you can specify them in View arguments.


Panels layout with sidebar next to 3 pane grid

Just take a peek at the current layouts you have, and you can probably figure out how to add new regions, it's fairly straightforward.

There's also a tutorial here: http://drupal.org/node/495654


Configure a view to display nodes that match a term value of the container node

The request to show sibling nodes through Taxonomy is one of the most common Views requests.

You case seems to be the simplest one, you can use the Has taxonomy term ID Contextual filter.

Create your Views listing Events
Add the Has taxonomy term ID Contextual filter and configure it:

When the filter value is NOT available
Provide default value
Taxonomy term ID from URL
Load default filter from node page, that's good for related taxonomy blocks
Filter to items that share any term
When the filter value IS available or a default is provided
Specify validation criteria
Taxonomy term ID
[your vocabulary]
Single ID
Place your Block Display on Programs nodes and configure Block settings for the contextual filter.


CKEditor is adding inline style to resize my textarea on node add/edit form

It turns out this is a documented problem in CKEditor. There are some workarounds posted at https://www.drupal.org/node/1154730 but I'd also be intersted in hearing any other ideas.


How can i restrict /admin login page to a particular IP only?

I think I would go for doing this at the Apache level before hitting Drupal.

Have a look at the Apache manual for doing this but you are looking at something like this:

# Only allow request for admin only from localhost.
<Location /admin>
  Deny from all
  Allow from 127.0.0.1
</Location>

So admin will be denied for all but allowed from 127.0.0.1 for example. Also take in to account cleanurls. You will need to deny access to ?q=admin aswell.


Flush cache of individual node when updated?

If you are using node_save, cache for the particular node will be cleared automatically. If you are using any other method to save the node then use the following,

entity_get_controller('node')->resetCache(array($node->nid));